Metamodeling - Advanced Software Engineering Course 2014/2015

Post on 27-Jun-2015

196 views 1 download

Tags:

description

Slides of the Metamodeling Lab for the Advanced Software Engineering Course 2014/2015 at DISIM, University of L'Aquila

Transcript of Metamodeling - Advanced Software Engineering Course 2014/2015

Metamodeling Lab

(Advanced Software Engineering course)a.y. 2014/2015

Luca BerardinelliPost Doc @ DISIM

University of L’Aquila

Copyright Notice

The material in these slides may be freely reproduced and distributed, partially or totally, as far as an explicit reference or acknowledge to the material author is preserved.

Lecturer

What does “modeling” stand for?

"Modeling, in the broadest sense, is the cost-effective use of something in place of something else for some cognitive purpose. It is simpler, safer or cheaper than reality”. A model represents reality for the given purpose; the model is an abstraction of reality in the sense that it cannot represent all aspects of reality.

Is Cristoforo Colombo a modeler?Sailors have drawn maps to travel around the world. Cognitive purpose: e.g., to support commercial/military activities

Sailor

map(s)<<creates>><<read by>>

SailorREALITY(world)

<<represented by>>

<<specified in>>

language?

language?

<<specified in>>

<<defines>>you

today

Is Cristoforo Colombo a modeler?Sailors have drawn maps to travel around the world. Cognitive purpose: e.g., to support commercial/military activities

map(s)

REALITY(world)

<<represented by>>

<<specified in>>

language?

language?

<<specified in>>

M0

M1

M2

M3

Maps today: from M0 to M3

M0 : <Data,Reality>

M1 : <Model>

M2 : <MetaModel>

M3 : <MetaMetaModel>

The right answers

M0 : It is under your feet!

M1 : The map itself except...

M2 : The legend list that provides decoding info, the concepts to build model)

M3 : It is not on the map. It provides the concepts to define different legends (M2)

A Model-Driven Software Process

Reqs Specs Design Implementation Deployment Runtime

Problem domain Solution domain (sw)

MMMMMMMM

MMMM MM

MMMM MM

MMMM MM

MMMM

< abstraction gap >

Different artifacts (e.g., models) can be created during the development process.

These artifacts may be used for communication purposes among stakeholders (architects, designers, programmers...)In MDE, these artifacts must be machine readable!

New Domain: Software EngineeringWhich language(s)? Do we need new, domain specific languages? How do we create new languages?

DesignerDesigner,Programmer,....

REALITY(software system)

<<specified in>>

language?

language(s)?

<<specified in>>

<<defines>>you

today

<<represented by>>

New Domain: Software EngineeringWhich language(s)? Do we need new, domain specific languages? How do we create new languages?

DesignerDesigner,Programmer,....

REALITY(software system)

<<specified in>>

EBNF

Java

<<specified in>>

<<defines>>you

today

<<represented by>>

http://cs.fit.edu/~ryan/cse4251/mini_java_grammar.html

New Domain: Software EngineeringWhich language(s)? Do we need new, domain specific languages? How do we create new languages?

DesignerDesigner,Programmer,....

REALITY(software system)

<<specified in>>

Ecore

MyLanguage

<<specified in>>

<<defines>>you

today

<<represented by>>

Modeling Framework(EMF)

Rich Client Platform(RCP)

Digital Library System

We want to build a distributed software system for managing a Digital Library. The customers can access the digital edition (e.g. PDF or PS file format) from a client application. On the server side, the system stores the description of the documents (its name, type, authors…). The librarian, properly logged within the system as “librarian” can add, modify, or delete the documents….The distributed system can be implemented using JAVA based technologies …[…]

Reqs Specs

DesignLibrary Metamodel (M2)

We define a very simple “domain-specific” language for modeling libraries. We use Ecore provided by Eclipse EMF.

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.emf.doc/tutorials/clibmod/clibmod.html

You can use any editor capable to “save” this artifact “as” *.ecore

LIBRARY Metamodel(Ecore)

Library Model Editor (M1)

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.emf.doc/tutorials/clibmod/clibmod.html

Conforms to

Library Editor(Eclipse RCP App)

We implement an Editor to realize Library Models using Eclipse RCP plugin.

Design

My Library Model (M1): serialization

<?xml version="1.0" encoding="UTF-8"?><Library:Library xmlns:Library="http://Library" xmlns:_="" name="Luca's Library"> <writers _:books="#//@books.1" name="Luca Berardinelli"/> <writers _:books="#//@books.0" name="Unknown"/> <books writers="#//@writers.1" title="Alone in The Dark" pages="123"/> <books writers="#//@writers.0" title="My Life" pages="400" category="Bibiography"/></Library:Library>

An modeler is able to structure and store information about a specific domain in a machine-readable way, so that software can “reason” about such a domain.

A real library (M0)