1. Metamodeling
Lab
(Advanced Software Engineering course)
a.y. 2014/2015
Luca Berardinelli
Post Doc @ DISIM
University of L’Aquila
2. 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.
4. 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.
5. Is Cristoforo Colombo a modeler?
Sailors have drawn maps to travel around the world. Cognitive
purpose: e.g., to support commercial/military activities
Sailor
<<specified in>>
<<creates>> map(s)
<<read by>>
Sailor
<<represented by>>
REALITY
(world)
language?
language?
<<specified in>>
<<defines>>
you
today
6. 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)
<<represented by>>
<<specified in>>
REALITY
(world)
language?
language?
<<specified in>>
M0
M1
M3
M2
7. Maps today: from M0 to M3
M3 : <MetaMetaModel>
M2 : <MetaModel>
M1 : <Model>
M0 : <Data,Reality>
8. The right answers
M3 : It is not on the map. It provides the
concepts to define different legends (M2)
M2 : The legend list that provides decoding
info, the concepts to build model)
M1 : The map itself except...
M0 : It is under your feet!
9. A Model-Driven Software Process
Problem domain < abstraction gap >
Solution domain (sw)
Reqs Specs Design Implementation Deployment Runtime
MMM
MMM
MMM
MMM
MMM
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!
10. New Domain: Software Engineering
Which language(s)? Do we need new, domain specific
languages? How do we create new languages?
Designer
Designer,
Programmer,
....
language?
<<specified in>>
language(s)?
REALITY
<<specified in>>
(software system)
<<defines>>
you
today
<<represented by>>
11. New Domain: Software Engineering
Which language(s)? Do we need new, domain specific
languages? How do we create new languages?
Designer
Designer,
Programmer,
....
<<specified in>>
REALITY
(software system)
EBNF
Java
<<specified in>>
<<defines>>
you
today
<<represented by>>
http://cs.fit.edu/~ryan/cse4251/mini_java_grammar.html
12. New Domain: Software Engineering
Which language(s)? Do we need new, domain specific
languages? How do we create new languages?
Designer
Designer,
Programmer,
....
<<specified in>>
REALITY
(software system)
Ecore
MyLanguage
<<specified in>>
<<defines>>
you
today
<<represented by>>
Modeling Framework
(EMF)
Rich Client Platform
(RCP)
13. Digital Library System
Reqs Specs
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 …[…]
14. Design
Library Metamodel (M2)
LIBRARY Metamodel
(Ecore)
We define a very simple “domain-specific” language for modeling
libraries. We use Ecore provided by Eclipse EMF.
You can use any editor
capable to “save” this
artifact “as” *.ecore
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.emf.doc/tutorials/clibmod/clibmod.html
15. Library Model Editor (M1)
Design
We implement an Editor to realize Library Models using Eclipse
RCP plugin.
Conforms to
Library Editor
(Eclipse RCP App)
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.emf.doc/tutorials/clibmod/clibmod.html
16. 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.