SlideShare una empresa de Scribd logo
1 de 135
Model-Driven Engineering
From code to models
Jean-Michel Bruel
LatinAmerican School on SE, Rio de Janeiro, July 2013
"To persuade me of the merit of your language,
you must show me how to construct models in it."
1978 Turing Award Lecture
July 2013 bruel@irit.fr 2
About this document…
 Target audience
 Master’s students
 Basic knowledge in UML, Java, (Ruby)
 Author
 Professor at IUT de Blagnac (Technical Institute)
 For all comments: bruel@irit.fr
 More available here:
 http://jmb.c.la
python code
Ruby code
AspectJ code
- Legend-
July 2013 bruel@irit.fr 3
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
July 2013 bruel@irit.fr 4
What is it all about?
 Understand metaprogramming
 Apply it to understand MDE
class BoutDeCode
# "constructeur"
def initialize(nom)
@nom = nom
end
def bonjour
puts "salut moi c'est " << @nom
end
end
July 2013 bruel@irit.fr 5
What is it all about? (ctd.)
July 2013 bruel@irit.fr 6
What is it all about? (ctd.)
 Several possible usage:
 Code Evolution
 Dynamic Adaptation
 example: self-healing
 Notion of context or « mode »
 Deployment on heterogeneous targets
 etc.
July 2013 bruel@irit.fr 7
What is it all about? (ctd.)
 Another Python example
July 2013 bruel@irit.fr 8
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
July 2013 bruel@irit.fr 9
Model or code?
 Possible collaboration Model/Code:
 code as "first class citizen"
 XP
 model as "first class citizen"
 MDE
 model => code
 Code generation
 code => model
 Reverse engineering
 sharing at same time code / model
 Recent tools
 models@runtime
July 2013 bruel@irit.fr 10
Model or code (ctd.)?
 Code generation
 Advantages
 productivity
 quality
 Maintainability
 How
 Files (e.g., XML)
 annotations / markup
 Limitations
 "code is more read than written"
July 2013 bruel@irit.fr 11
Model or code (ctd.)?
 models@runtime
 Advantages
 Focus on design
 More users in the loop
 Knowledge acquisition and capitalization
 How
 Specific tools (e.g. Kermeta)
 Dedicated libraries (e.g. PauWare)
 Limitations
 Too precise too early
July 2013 bruel@irit.fr 12
Model or code (ctd.)?
 profiles / DSL
 profiles
 adapt/refine the semantic (e.g., WPCP)
 validation rules
 Numerous tools
 Domain Specific Languages (DSL)
 Close to users
 Initial work is important
July 2013 bruel@irit.fr 13
Integrated approach
 Apply programming techniques to
models
 languages to manipulate artefacts
 languages to transform models
 Study meta-programming
 definitions
 examples
July 2013 bruel@irit.fr 14
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
July 2013 bruel@irit.fr 15
Why Meta?
 Some thoughts
 Why should we manipulate data and
functions only (what about code itself)?
 Some functionality "crosscut"
 Extra-functional properties
 // with metadata
 "About …"
 Data about data
 e.g., HTML META tag
July 2013 bruel@irit.fr 16
Definitions
 Abstraction
 "one thing that represents several real things
equally well" (E.W. Dijkstra, 1967)
 Model
 System description
 Built for a precise purpose
 Usable to predict or analyze its behavior
 Aspect (in modeling, not in AOP)
 System view
July 2013 bruel@irit.fr 17
Definitions (ctd.)
 Metaprogramming:
 Writing programs using programs
 Several possible ways:
 Code generation
 Templates programming (e.g. C++)
 Powerful languages (Java, Ruby, python)
 Macros
 etc.
July 2013 bruel@irit.fr 18
Definitions (ctd.)
 Reflection:
 A language is called reflective if it allows:
 introspection: possibility to analyze the
language itself
 intercession: possibility to modify the objects’
behavior at run-time
 Examples
 Smalltalk
 Java
 Ruby
July 2013 bruel@irit.fr 19
Reflection
 Different types
 structural (object->class->metaclass->…)
 operational (memory, resources, etc.)
 Different timing
 compilation time
 load time
 run time
July 2013 bruel@irit.fr 20
Limitations
 Low performance
 Encapsulation broken
July 2013 bruel@irit.fr 21
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
July 2013 bruel@irit.fr 22
Aspect-Oriented Programming (AOP)
 Generalization of metaprogramming
 Modularity, reusability, etc.
 Cf. Ruby example
July 2013 bruel@irit.fr 23
AOP (ctd.)
http://www.dotnetguru.org
July 2013 bruel@irit.fr 24
AOP (ctd.)
 Classical usage:
 Logging/Tracing
 Exceptions management
 Debugging/Tests
 Assertions/Contracts/Constraints
 Performances optimization
 Change detection
 Access Synchronization
 Persistence
 Security/login
 Design patterns
July 2013 bruel@irit.fr 25
AOP (ctd.)
 Limitations
 Aspect = code to be inserted at certain
points in the application
 Resulting code complicated
 Difficult to test
July 2013 bruel@irit.fr 26
Classes as objects
 Class Manipulation
 Avoid repetitive code
 Find an object’ class
 Modify a class dynamically
July 2013 bruel@irit.fr 27
Avoid repetitive code
 Example of accessors
class BoutDeCode
# "constructeur"
def initialize(nom)
@nom = nom
end
…
end
…
# oups, j'ai oublié les accesseurs
class BoutDeCode
attr_accessor :nom
end
July 2013 bruel@irit.fr 28
Avoid repetitive code (ctd.)
 Example of tests
#test/person_test.rb
require File.join(… 'person')
require 'test/unit'
class PersonTest < Test::Unit::TestCase
def test_first_name
p = Person.new('John','Doe',25)
assert_equal 'John' p.first_name
end
def test_last_name
p = Person.new('John','Doe',25)
assert_equal 'Doe' p.last_name
end
…
end
July 2013 bruel@irit.fr 29
Find an object’ class
 trivial for interpreted languages
 dedicated libraries
 Java : java.lang.reflect
 .Net : System.Reflection
July 2013 bruel@irit.fr 30
Find an object’ class
July 2013 bruel@irit.fr 31
Modify a class
 Dynamicity and adaptation
 Example: method redefinition
class Foo # déjà définie ailleur
# la méthode foom est buggée
# on la renomme au cas où
alias :foom_BUG :foom
# et on la redéfinit
def foom
…
end
end
July 2013 bruel@irit.fr 32
AOP
 Basic Concepts
 Pointcut
 Manipulable code element (e.g., function f)
 Jointpoint
 Precise activity (method call, constructors, etc.)
 Advice
 code to be activated (e.g., log)
 Moment to activate (e.g., before)
 Aspect weaving
 Available for almost all languages
 Can be seen as a particular model transformation
July 2013 bruel@irit.fr 33
AspectJ
 Pointcuts
 call/execution
 get/set
 handler
 initialization()
 adviceexecution()
// exemple de pointcut
call(void Point.SetX(int))
July 2013 bruel@irit.fr 34
AspectJ (pointcuts)
 Method signature
 Pointcuts combination
 ||, &&, !
 Naming possibility
pointcut modified() :
call(void Point.SetX(int)) ||
…
call(void Point.SetX(int)) ||
call(void Point.SetY(int))
call(void Point.SetX(int))
July 2013 bruel@irit.fr 35
AspectJ (pointcuts, ctd.)
 Genericity
 Even on pointcuts themselves
 Existing primitive pointcuts
 this
 target
 args
cflow(modified())
call(void Point.Set*())
July 2013 bruel@irit.fr 36
AspectJ (advices)
 Link between pointcut & code
 Possible Links:
 before
 after
 around
before(): modified() {
System.out.println("modification!");
}
link
codepointcut
July 2013 bruel@irit.fr 37
AspectJ (advices, ctd.)
 parameters
pointcut setXY(FigureElement fe, int x, int y):
call(void FigureElement.setXY(int, int))
&& target(fe)
&& args(x, y);
after(FigureElement fe, int x, int y) returning:
setXY(fe, x, y) {
System.out.println(fe + " moved to (");
System.out.println(x + ", " + y + ").");
}
July 2013 bruel@irit.fr 38
AOP (ctd.)
 Ruby: require 'aspectr'
July 2013 bruel@irit.fr 39
AOP (ctd.)
July 2013 bruel@irit.fr 40
MDE Application
 Same manipulation
 No real dedicated support yet
 A-QVT / A-ATL ?
 Aspect code generation -> QVT/ATL?
July 2013 bruel@irit.fr 41
MDE Application (ctd.)
 Design patterns
 "Aspectization" of design patterns
 Use for model transformation
July 2013 bruel@irit.fr 42
Patron Observer (java)
 Figures example
July 2013 bruel@irit.fr 43
Patron Observer (java, ctd.)
 Pattern
[Gamma, 1995]
[java.util]
July 2013 bruel@irit.fr 44
Patron Observer (java, ctd.)
 What is observable?
public abstract class FigureElement extends Observable{…}
July 2013 bruel@irit.fr 45
Patron Observer (java, ctd.)
 Who observes what?
 A line observes "its" points
public class Line extends FigureElement implements Observer{
Point p1,p2;
public Line(Point origine, Point destination) {
p1 = origine;
p2 = destination;
p1.addObserver(this);
p2.addObserver(this);
}
July 2013 bruel@irit.fr 46
Patron Observer (java, ctd.)
 Who observes what?
 A figure observes everything
public class Figure implements Observer {
…
public void addLine(line l){
this.ens.add(l);
l.addObserver(this);
}
…
July 2013 bruel@irit.fr 47
Patron Observer (java, suite)
 What happens when a change occurs?
 notifying
public void setXY(int x, int y) {
…
setChanged();
this.notifyObservers();
}
July 2013 bruel@irit.fr 48
Patron Observer (java, suite)
 What happens when a change occurs?
 Reacting (line example)
public void update(Observable o, Object arg) {
if (o==p1)
System.out.print("modification de mon p1");
else System.out.print("modification de mon p2");
draw();
}
July 2013 bruel@irit.fr 49
Patron Observer (java, suite)
 What happens when a change occurs?
 Reacting (figure example)
public void update(Observable o, Object arg) {
if (o instanceof Point)
System.out.println("modif. d'un point");
else
System.out.println("modif. d'une ligne");
((FigureElement)o).draw();
}
July 2013 bruel@irit.fr 50
Observer (AspectJ)
 Either we stay close to the code
 Modifying classes consequently
 extends Observable
 implements Observer
 List all pointcuts
 Members modification (e.g., setXY)
 Coding advices
 setChanged();
 this.notifyObservers();
 public void update() {}
July 2013 bruel@irit.fr 51
Observer (AspectJ)
 Either we "simulate"
 List of pointcuts
 Members modification (e.g., setXY)
 Coding advices
 observers management (internally)
 Concrete and Abstract Aspect (generic)
July 2013 bruel@irit.fr 52
Observer (AspectJ)
[Inforsid2003]
July 2013 bruel@irit.fr 53
MDE application
 Design patterns
 Use for model transformation
 See Research papers
July 2013 bruel@irit.fr 54
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
Xtext
 Framework for DSL
 Domain Specific Language
 Integrated with Eclipse EMF
 Allows automated generation of:
 Parser/lexer (for code generation)
 Ecore MM
 Moels Import/export into EMF
July 2013 bruel@irit.fr 55
General principles
 Example of target syntax
July 2013 bruel@irit.fr 56
General principles (ctd.)
 Xtext project under Eclipse
 Language name (for the DSL)
 File Extension
July 2013 bruel@irit.fr 57
General principles (ctd.)
 Files generated
 The project itself
 Grammar description
 Constraints, behavior, …
 User Interface .ui
 Editor, « outline », code completion, …
 Code generator .generator
July 2013 bruel@irit.fr 58
Grammar Description
 Close to EBNF
July 2013 bruel@irit.fr 59
Framework generation
 Using the generator
 GenerateXXX.mwe
 Project launching
 Either as an eclipse plug-in
 Either as an eclipse application
July 2013 bruel@irit.fr 60
Framework usage
July 2013 bruel@irit.fr 61
Model Manipulation
 Writing code generator
 Templates .xpt
July 2013 bruel@irit.fr 62
Model Manipulation (ctd.)
July 2013 bruel@irit.fr 63
MDE Motivation
 Evolution of new technologies
 Separation between domain and
architecture
 Algorithm stability
 Know-how Capitalization
 Design pattern
 Domain Objects
 => necessity to abstract from code
July 2013 bruel@irit.fr 64
MDA
 Model-Driven Architecture
 OMG
 Notions of:
 PIM: Platform Independent Model
 PSM: Platform Specific Model
 CIM: Computation Independent Model
July 2013 bruel@irit.fr 65
MDE
 Model-Driven Engineering
 More general than MDA
 Less focus on architectures
 Models as first-class citizen
July 2013 bruel@irit.fr 66
Basic Concepts
 Models
 Metamodels and levels
 Language, syntax, semantic
 Transformations
July 2013 bruel@irit.fr 67
Model
 Model
 Abstraction of a system
 Designed for a defined purpose
 Usable to predict/simulate/validate
 Description vs. Specification
 Description => existing system
 Specification => expected system
July 2013 bruel@irit.fr 68
Model (ctd.)
 Objectives
 Deal with systems complexity
 SoC
 Formalize intuitive elements
 Communication (inside/outside the team)
July 2013 bruel@irit.fr 69
Model (ctd.)
 Diverse and numerous
 Different life cycle
 Level of abstraction
 Viewpoints
=> multiplicity of models
July 2013 bruel@irit.fr 70
Model (ctd.)
 Example of UML
 Behavioral models
 Analysis models
 Data models
 Communications models
 …
July 2013 bruel@irit.fr 71
Model (ctd.)
 Benefits of a « formal » representation
 => notion of conformity
 => notion of metamodel
July 2013 bruel@irit.fr 72
Metamodel and levels
July 2013 bruel@irit.fr 73
Source : Jean Bézivin
Metamodel (ctd.)
 Examples
 Programs
 Process/Program/Grammar/EBNF
 XML
 Data/XML file/DTD/??
 UML
 Class/Class Diagram/UML/UML!!
July 2013 bruel@irit.fr 74
Metamodel (ctd.)
 Instanciation / conformity
 Class <-> Object
 => instanciation
 An object is a class instance
 Model (M) <-> Metamodel (MM)
 => conformity
 A model is not an instance of a MM
 A MM is not a model of the model
July 2013 bruel@irit.fr 75
Metamodel (ctd.)
 OMG Vocabulary
 MOF: Meta-Object Facility
 Common MM
 UML 2.0
 CWM
 QVT
July 2013 bruel@irit.fr 76
Metamodel (ctd.)
 Comparison MOF/EBNF
 BNF : Bakcus-Naur Form
July 2013 bruel@irit.fr 77
-- Exemple des adresses US :
<postal-address> ::= <name-part> <street-address> <zip-part>
<name-part> ::= <personal-part> <last-name> <opt-jr-part> <EOL>
| <personal-part> <name-part>
<personal-part> ::= <first-name> | <initial> "."
<street-address> ::= <opt-apt-num> <house-num> <street-name> <EOL>
<zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL>
<opt-jr-part> ::= "Sr." | "Jr." | <roman-numeral> | ""
-- Exemple des adresses US :
<postal-address> ::= <name-part> <street-address> <zip-part>
<name-part> ::= <personal-part> <last-name> <opt-jr-part> <EOL>
| <personal-part> <name-part>
<personal-part> ::= <first-name> | <initial> "."
<street-address> ::= <opt-apt-num> <house-num> <street-name> <EOL>
<zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL>
<opt-jr-part> ::= "Sr." | "Jr." | <roman-numeral> | ""
Metamodel (ctd.)
 Comparison MOF/EBNF (ctd.)
 EBNF : Extended Bakcus-Naur Form
July 2013 bruel@irit.fr 78
« conforms to »
Metamodel (ctd.)
 Comparison MOF/EBNF (ctd.)
July 2013 bruel@irit.fr 79
MOF EBNF
DSL for models DSL for syntax
Metamodel Meta-syntax
To write models To describe programming
languages
« Initiated » by OMG and then
normalized by ISO
Normalised by ISO
Language, syntax, semantic
 To start with…
 Difference between data & information?
July 2013 bruel@irit.fr 80
Data Information
Representation of the
information
Element of knowledge
Used to communicate Interpretation of the data
e.g.: - June, 21 2013 -
2013 Summer day
Same information
e.g.: yersteday Context dependency
Language, syntax, semantic
 General concepts
 To communicate we need one (or more)
language(s)
 A model (M) is not a language
 But can be the description of a language
 A metamodel (MM) neither
July 2013 bruel@irit.fr 81
Language, syntax, semantic
 A language consists in
 A syntactic notation
 A set of legal elements (combination of
terms)
 An interpretation for these termes
July 2013 bruel@irit.fr 82
Language, syntax, semantic
 Syntax
 Set of rules for the basic notation
 Semantic Domain
 Set of interpretations for the notation
 Semantic
 « mapping » from syntax to semantic
domain
July 2013 bruel@irit.fr 83
Examples
 Syntax
<Exp>::=<Number>|
<Variable>|
<Exp>+<Exp>|…
 Semantic domain
 Set of natural numbers
 Semantic
 Associating a natural
number to each
expression
July 2013 bruel@irit.fr 84
 Syntax
 Semantic domain
 Set of traces
 Semantic
 Trace log
Syntax
 Examples
 Words, sentences, declarations, boxes,
schemas, terms, modules, …
 Different kinds
 Graphical
 Textual
 Abstract
 Concrete
 Language for its representation
 Textual => grammar
 Graphical => graphs
July 2013 bruel@irit.fr 85
Semantic
 Operational
 Set of states and transitions between those
states
 Denotational
 Math. function that transfer from one state
to the other
 Axiomatic
 Logical properties on states
July 2013 bruel@irit.fr 86
Illustrations
 Example: signification of « X = X+Y »
 « at this point of the program X must
contain the same value as X+Y »
 X receive X+Y
 What X+Y means?
 => it depends on the semantic
July 2013 bruel@irit.fr 87
Example of the MIU system
 Taken from [GEB,1989]
 Problem: "can we produce MU?"
 Rules
 Considering an initial chain (MI)
 And some production rules (or inference)
 The alphabet has only 3 lettres (M,I,U)
 r1: if a chain finishes by I we can add U
 r2: if a chain is of form Mx we can create Mxx
 r3: III can be replaced by U
 r4: UU can be eliminated
 Implicit rule: we can only do what is authorized!
July 2013 bruel@irit.fr 88
MIU (ctd.)
 Illustration of the rules
 r1: I ending => we can add U
 MI -> MIU
 r2: Mx => Mxx
 MU -> MUU
 MUI -> MUIUI
 r3: III can be replaced by U
 UMIIIU -> UMUU
 r4: UU can be removed
 MUUUI -> MUI
July 2013 bruel@irit.fr 89
MIU (ctd.)
 Problem: can we get MU from MI?
 Go ahead and try for a while
 chains can be seen as theorem
 Hence MU is a theorem that has to be proven
 MI is an axiom
 Notion of derivation (example for MUIIU :)
MI (axiom)
MII (r2)
MIIII (r2)
MIIIIU (r1)
MUIU (r3)
MUIUUIU (r2)
MUIIU (r4)
July 2013 bruel@irit.fr 90
MIU (ctd.)
 MUIIU can be "proven"
 Some properties are "obvious": all theorems start
with M, but no program can say it => difference
between man and machine!
 "it is possible for a machine to act unobservant,
not for a human"
 Difference between being in and out of the formal
system
 Playing with the rules => in
 Asking why MU is not provable => out
July 2013 bruel@irit.fr 91
Formal systems
 Being able to determine whether an expression
is correct (well-formed)
 Being complete (completeness)
 Any correct expression should have a meaning
 Being consistent
 An expression cannot have different meanings
 Both properties are complementary
 BUT you cannot have both! (Gödel theorem)
July 2013 bruel@irit.fr 92
Formal verification
 Undecidability of the correctness proof
 Partial solution = test
 Checking for errors
 Not finding one doesn’t mean there is no one
 State machines
 model-checking
 Problem of combinatory explosion
 Formal proofs
 theorem proving
 More an helping system that a proof system
July 2013 bruel@irit.fr 93
Example of UML profiles
 Possibility of language extension
 Stereotypes
 Tagged Values
 OCL constraints
July 2013 bruel@irit.fr 94
http://web.univ-pau.fr/~ecariou/cours/idm/cours-meta.pdf
Example of UML profiles (ctd.)
 profile for EJB
 SysML
 MARTE
July 2013 bruel@irit.fr 95
Transformations
 Objectives
 Models as « first level citizen »
 Bridges between models
 Basic principles
 Going from a source model (Min) to a
target model (Mout)
July 2013 bruel@irit.fr 96
Transformations (ctd.)
 Basic mechanisms
 Take informations from Min
 Generate/modify informations into Mout
 Link with maths
 Bijection, morphisms, …
 Formal description
July 2013 bruel@irit.fr 97
Transformations (ctd.)
 MDA vocabulary
 CIM : Computation Independent Model
 E.g., UML Use Cases
 PIM : Platform Independent Model
 E.g., UML Class Diagram
 PSM : Platform Specific Model
 E.g., EJB model
 PDM : Platform Description Model
 E.g., AADL
July 2013 bruel@irit.fr 98
Transformations (ctd.)
 General vocabulary
 M2M : Model To Model
 E.g., Class Diag. <-> E/R diag.
 M2T : Model To Texte
 E.g., Class Diag. -> Java code
July 2013 bruel@irit.fr 99
Transformations (ctd.)
 What language for transformations?
 M2T
 Code generation
 Mainly based on templates
 E.g.: VTL, JET
 M2M
 Less popular
 E.g.: QVT, ATL
 « XSLT-like »
July 2013 bruel@irit.fr 100
Transformations (ctd.)
 What language for transformations?
 Endogenes
 Same metamodel
 E.g.: UML Statemachine / UML Classe diagrams
 Exogenes
 Different metamodels
 E.g.: UML Statemachine / Petri nets
July 2013 bruel@irit.fr 101
Y
Transformations (ctd.)
 Usual term (« Y cycle »)
July 2013 bruel@irit.fr 102
PIMPIM
PSMPSM
PDMPDM
PIMPIM PDMPDM
PSMPSM
refinement refinement
refinement
projection
codecode
Code
generation
Retro-
engineering
Transformations (ctd.)
 Quiz
 Compilation: is it transformation?
 Could you provide me an exogene
transformation example?
July 2013 bruel@irit.fr 103
Basic tools
 Eclipse
 EMF (Eclipse Modeling Framework)
 Framework for manipulating models
 Persistence management
 meta-meta-model: Ecore
 GMF (Graphical Modeling Framework)
 GEF (Graphical Editing Framework)
July 2013 bruel@irit.fr 104
Eclipse Modeling Framework
 Input files
 UML (Ecore-compatible tools)
 Plugin UML2
 Papyrus
 Rational (.mdl)
 XMI
 Pb. With compatibility
 Java annotated
 @model
July 2013 bruel@irit.fr 105
Ecore
July 2013 bruel@irit.fr 106
ATL (Atlas Transformation Language)
 French answer to QVT
 Query/View/Transformation
 OMG standard
July 2013 bruel@irit.fr 107
ATL (ctd.)
 Example 1
July 2013 bruel@irit.fr 108
ATL (ctd.)
 Example 2
 Taken from:
 http://web.univ-pau.fr/~ecariou/cours/idm
July 2013 bruel@irit.fr 109
ATL example
 Expected transformation
July 2013 bruel@irit.fr 110
ATL example (ctd.)
 MM definition
July 2013 bruel@irit.fr 111
ATL example (ctd.)
 MM definition (ctd.)
July 2013 bruel@irit.fr 112
ATL example (ctd.)
 Transformations description
 Header
July 2013 bruel@irit.fr 113
module TransformationProxy; -- Module Template
create OUT : ClientProxyServeur from IN : ClientServeur;
module TransformationProxy; -- Module Template
create OUT : ClientProxyServeur from IN : ClientServeur;
ATL example (ctd.)
 Transformations description
 Server modification
July 2013 bruel@irit.fr 114
rule LeServeur {
from
serveurSource : ClientServeur!Serveur
to
serveurCible : ClientProxyServeur!Serveur (
nom <- serveurSource.nom,
connecteA <- ClientProxyServeur!Proxy.allInstances()
)
}
rule LeServeur {
from
serveurSource : ClientServeur!Serveur
to
serveurCible : ClientProxyServeur!Serveur (
nom <- serveurSource.nom,
connecteA <- ClientProxyServeur!Proxy.allInstances()
)
}
ATL example (ctd.)
 Transformations description
 Clients modifications
July 2013 bruel@irit.fr 115
rule Clients{
from
clientSource : ClientServeur!Client
to
clientCible : ClientProxyServeur!Client (
nom <- clientSource.nom,
utilise <- clientSource.utilise,
connecteA <- proxy
),
proxy : ClientProxyServeur!Proxy (
nom <- clientSource.nom + ClientServeur!Serveur.allInstances().first().nom,
clientConnecte <- clientCible,
serveurConnecte <- ClientProxyServeur!Serveur.allInstances().first(),
implemente <- clientCible.utilise
)
}
rule Clients{
from
clientSource : ClientServeur!Client
to
clientCible : ClientProxyServeur!Client (
nom <- clientSource.nom,
utilise <- clientSource.utilise,
connecteA <- proxy
),
proxy : ClientProxyServeur!Proxy (
nom <- clientSource.nom + ClientServeur!Serveur.allInstances().first().nom,
clientConnecte <- clientCible,
serveurConnecte <- ClientProxyServeur!Serveur.allInstances().first(),
implemente <- clientCible.utilise
)
}
ATL example (ctd.)
 Transformations description
 Interface modifications
July 2013 bruel@irit.fr 116
rule Interfaces {
from
interSource : ClientServeur!Interface
to
interCible : ClientProxyServeur!Interface (
nom <- interSource.nom,
estUtiliseePar <- interSource.estUtiliseePar,
estImplementeePar <- (ClientProxyServeur!Proxy.allInstances()
-> select (p | p.implemente = interCible).first())
)
}
rule Interfaces {
from
interSource : ClientServeur!Interface
to
interCible : ClientProxyServeur!Interface (
nom <- interSource.nom,
estUtiliseePar <- interSource.estUtiliseePar,
estImplementeePar <- (ClientProxyServeur!Proxy.allInstances()
-> select (p | p.implemente = interCible).first())
)
}
MD* best practices
 Reference
 MD* Best Practices, Markus Völter, 2008.
July 2013 bruel@irit.fr 117
http://www.voelter.de/data/articles/DSLBestPractices-Website.pdf
July 2013 bruel@irit.fr 118
Content
 Why learning MDE from code ?
 Model or code
 Metaprogramming
 Aspect Oriented Programming
 Model-Driven Engineering
 Self-Adaptive Systems
Ambient systems
 Definition (what I mean):
 Human beings + components + interactions
 Physical entities of distributed software
 Capable of interacting with their environment
 With autonomous behavior
 Able to self-adapt to their context
 Problems:
 Collection of components (interaction, emerging
properties)
 AI (decision taking, self-adaptation, etc.)
 Environment and context (definition, monitoring)
 Methods and tools for developing such systems
July 2013 bruel@irit.fr 119
Ambient systems (IRIT lab.)
July 2013 bruel@irit.fr 120
120
Anytime
Anywhere
Anything
24h/24
7/7
Professionnal
Private
…
Between PC
Between people (PDA,…)
Indoor/Outdoor
Office, home, …
Phone, mobile, …
Intelligence
Context analysis, self-adaptation.
Reasoning and modeling…
IC3, LILaC, SMAC, MACAO,
SIG teams
Natural Interaction
Access to service as simple as
possible:
Gesture recognition, …
ICHS team
Monitoring
System is aware of its environment.
Cameras, micros, radars, RFID, …
SAMoVA, VORTEX teams
Ubiquity
User can interact from anywhere, with
Interconnected devices, sensors, …
Dynamic, trusted, heterogeneous networks
Distributed architectures
Models
ASTRE, SIERA teams
Ambient Intelligent Entities
 IRIT cross-cutting group
 AmIE project:
 2009/2014
 Soft. & Hard. Platform
 Based on scenarios
 12 IRIT teams involved!
 18,5 equivalent people
 33 PhD students
 Competitivity groups
 AESE (Aeronautics, RT&E)
 Cancer, Bio, Santé
Scenarios
 Intelligent
Campus
 Social aspects
 Financial aspects
 Different
viewpoints
 Students
 Professors
 Staff
 Technical services
 Home Supervision
 Social aspects
 Financial aspects
 Different
viewpoints
 Patient
 Medical staff
 Relatives
 Technicians
 …
122July 2013 bruel@irit.fr
Technical Institute of Blagnac
July 2013 bruel@irit.fr 123
 4 Departments
 Computer science (INFO)
 Maintenance & Industry (GIM)
 Networks & Telecoms (R&T)
 2A2M (Aide et Assistance pour le Monitoring et le
Maintien à domicile)
 Laboratoiries: 3 CNRS labs
 IRIT (Institut de Recherche en Informatique de Toulouse)
 LAAS (Laboratoire d’Analyse et d’Architecture des
Systèmes)
 LAPLACE (Laboratoire Plasma et Conversion d’Energie)
Application context
July 2013 bruel@irit.fr 124
[Ger@Home]
Technical details
 Static modules (nodes)
 Sensors
 Temperature (of the room)
 Hydrometer
 Luminosity
 Webcam
 Microphone & speaker (interaction)
 Mobile module (arm of the user)
 Temperature (of the user)
 Accelerometer
July 2013 bruel@irit.fr 125
Technical details (cont.)
 System monitoring:
 1« Master pc » receiving all information
from the nodes
 Communication system: zigbee
 Crossbow Technology Modules
 Imote2 Processor Radio Board (IPR2400) et
Imote2 Sensor Board (ITS400)
 Nodes programming in .NET Micro
Framework
July 2013 bruel@irit.fr 126
Problems
 Number of potential actors involved
 Number of disciplines involved
 Importance of the human factor
 Critical systems (human lives)
 Security and privacy concerns
 Complex modeling and development
process
July 2013 bruel@irit.fr 127
General architecture
 Context
 Requirements
 Vaguely defined
 Very evolving
 Multiple Technologies
 Solution
 Separate infrastructures and measures
 Precise / Rewrite requirements (e.g. RELAX
language)
 Layer-based Architecture
July 2013 bruel@irit.fr 128
General architecture (cont.)
 Layer-based Architecture
July 2013 bruel@irit.fr 129
General architecture (cont.)
 Basics:
 Abstraction of sensors
 Data Schema independent from the hardware
 Abstraction of processes
 Web services definition
 Encapsulating data access and processes
 Abstraction of applications
 Advantages:
 Greater evolutivity (physical, hardware and
software)
July 2013 bruel@irit.fr 130
Experimentation
 Database
July 2013 bruel@irit.fr 131
Experimentation (cont.)
 Context adaptation
July 2013 bruel@irit.fr 132
Conclusion
 Don’t learn modelling, do models
 Don’t hesitate to use your geek skills
with models too
July 2013 bruel@irit.fr 133
July 2013 bruel@irit.fr 134
Useful links
 Models
 « On the Unification Power of Models », Jean Bézivin, Revue
SoSyM, 4:2, 2005.
 « Meaningful Modeling: What’s the Semantics of Semantics »,
David Harel & Bernhard Rumpe, Revue IEEE Computer 37:10,
2004.
 MDE
 OMG web site: http://www.omg.org/
 Tools
 Kermeta (http://www.kermeta.org/)
 ATL (http://www.eclipse.org/m2m/atl/)
July 2013 bruel@irit.fr 135
Useful links (ctd.)
 Introspection & metaprogramming
 http://www.polytech.unice.fr/~blay/ENSEIGNEMENT/LOG8/Meta-
Programmer.pdf
 http://www.enib.fr/info/gl2/cours/metaprog.pdf
 Jean Bézivin. "On the Unification Power of Models", SoSyM 2005,
4(2).
 AOP
 http://www.eclipse.org/aspectj/
 Ruby par l'exemple (O'Reilly)
 Aspect-Oriented Modeling
 http://aosd.net/
 Xtext
 http://wiki.eclipse.org/Xtext/GettingStarted
 http://www.eclipse.org/Xtext/documentation/
 « On the Unification Power of Models », Jean Bézivin, Revue SoSyM,
4:2, 2005.

Más contenido relacionado

Destacado

Model-driven engineering of multimodal user interfaces
Model-driven engineering of multimodal user interfacesModel-driven engineering of multimodal user interfaces
Model-driven engineering of multimodal user interfacesJean Vanderdonckt
 
OCCIware: extensible and standard-based XaaS platform to manage everything in...
OCCIware: extensible and standard-based XaaS platform to manage everything in...OCCIware: extensible and standard-based XaaS platform to manage everything in...
OCCIware: extensible and standard-based XaaS platform to manage everything in...OCCIware
 
La &amp; edm in practice
La &amp; edm in practiceLa &amp; edm in practice
La &amp; edm in practicebharati k
 
Optimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsOptimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsEdward Willink
 
Modeling the OCL Standard Library
Modeling the OCL Standard LibraryModeling the OCL Standard Library
Modeling the OCL Standard LibraryEdward Willink
 
Model Transformation A Personal Perspective
Model Transformation A Personal PerspectiveModel Transformation A Personal Perspective
Model Transformation A Personal PerspectiveEdward Willink
 
Embedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEmbedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEdward Willink
 
The Importance of Opposites
The Importance of OppositesThe Importance of Opposites
The Importance of OppositesEdward Willink
 
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...OCCIware
 
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Edward Willink
 
Developpement mobile vs open source
Developpement mobile vs open sourceDeveloppement mobile vs open source
Developpement mobile vs open sourceKorteby Farouk
 
Design Thinking Assignment
Design Thinking AssignmentDesign Thinking Assignment
Design Thinking AssignmentSalma ES-Salmani
 
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware
 
Model Transformation: A survey of the state of the art
Model Transformation: A survey of the state of the artModel Transformation: A survey of the state of the art
Model Transformation: A survey of the state of the artTom Mens
 
النشاط العلمي - الكهرباء
النشاط العلمي  -   الكهرباءالنشاط العلمي  -   الكهرباء
النشاط العلمي - الكهرباءErradi Mohamed
 

Destacado (20)

Mof
MofMof
Mof
 
Model-driven engineering of multimodal user interfaces
Model-driven engineering of multimodal user interfacesModel-driven engineering of multimodal user interfaces
Model-driven engineering of multimodal user interfaces
 
OCCIware: extensible and standard-based XaaS platform to manage everything in...
OCCIware: extensible and standard-based XaaS platform to manage everything in...OCCIware: extensible and standard-based XaaS platform to manage everything in...
OCCIware: extensible and standard-based XaaS platform to manage everything in...
 
La &amp; edm in practice
La &amp; edm in practiceLa &amp; edm in practice
La &amp; edm in practice
 
Optimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsOptimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc results
 
Modeling the OCL Standard Library
Modeling the OCL Standard LibraryModeling the OCL Standard Library
Modeling the OCL Standard Library
 
Model Transformation A Personal Perspective
Model Transformation A Personal PerspectiveModel Transformation A Personal Perspective
Model Transformation A Personal Perspective
 
The OCLforUML Profile
The OCLforUML ProfileThe OCLforUML Profile
The OCLforUML Profile
 
Cvl
CvlCvl
Cvl
 
Embedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEmbedded OCL Integration and Debugging
Embedded OCL Integration and Debugging
 
The Importance of Opposites
The Importance of OppositesThe Importance of Opposites
The Importance of Opposites
 
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...
OCCIware Contribution to the EU consultation on Cloud Computing Research Inno...
 
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
 
Aligning OCL and UML
Aligning OCL and UMLAligning OCL and UML
Aligning OCL and UML
 
Developpement mobile vs open source
Developpement mobile vs open sourceDeveloppement mobile vs open source
Developpement mobile vs open source
 
Design Thinking Assignment
Design Thinking AssignmentDesign Thinking Assignment
Design Thinking Assignment
 
OCL 2.5 plans
OCL 2.5 plansOCL 2.5 plans
OCL 2.5 plans
 
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
 
Model Transformation: A survey of the state of the art
Model Transformation: A survey of the state of the artModel Transformation: A survey of the state of the art
Model Transformation: A survey of the state of the art
 
النشاط العلمي - الكهرباء
النشاط العلمي  -   الكهرباءالنشاط العلمي  -   الكهرباء
النشاط العلمي - الكهرباء
 

Similar a Model-Driven Engineering: a bottom-up approach based on meta-programming (ELA-ES'2013)

Software development effort reduction with Co-op
Software development effort reduction with Co-opSoftware development effort reduction with Co-op
Software development effort reduction with Co-oplbergmans
 
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...Hugo Bruneliere
 
Boosting productivity with "Plone-driven Plone development"
Boosting productivity with "Plone-driven Plone development"Boosting productivity with "Plone-driven Plone development"
Boosting productivity with "Plone-driven Plone development"Henning Rietz
 
Lightweight Model-Driven Engineering
Lightweight Model-Driven EngineeringLightweight Model-Driven Engineering
Lightweight Model-Driven EngineeringJordi Cabot
 
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in Nantes
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in NantesMoDisco & ATL - Eclipse DemoCamp Indigo 2011 in Nantes
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in NantesHugo Bruneliere
 
A Program Transformation Technique To Support AOP Within C Template
A Program Transformation Technique To Support AOP Within C   TemplateA Program Transformation Technique To Support AOP Within C   Template
A Program Transformation Technique To Support AOP Within C TemplateCrystal Sanchez
 
Introduction to C3.net Architecture unit
Introduction to C3.net Architecture unitIntroduction to C3.net Architecture unit
Introduction to C3.net Architecture unitKotresh Munavallimatt
 
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Hugo Bruneliere
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharpCao Tuan
 
Rust and Eclipse
Rust and EclipseRust and Eclipse
Rust and EclipseMax Bureck
 
OOAD-Unit1.ppt
OOAD-Unit1.pptOOAD-Unit1.ppt
OOAD-Unit1.pptrituah
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Christos Manios
 
Opensource gis development - part 5
Opensource gis development - part 5Opensource gis development - part 5
Opensource gis development - part 5Andrea Antonello
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
[SiriusCon 2018] A Bird's Eye View on Eclipse Sirius
[SiriusCon 2018]  A Bird's Eye View on Eclipse Sirius[SiriusCon 2018]  A Bird's Eye View on Eclipse Sirius
[SiriusCon 2018] A Bird's Eye View on Eclipse SiriusObeo
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle Databricks
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Deep Learning Italia
 

Similar a Model-Driven Engineering: a bottom-up approach based on meta-programming (ELA-ES'2013) (20)

Software development effort reduction with Co-op
Software development effort reduction with Co-opSoftware development effort reduction with Co-op
Software development effort reduction with Co-op
 
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...
EMF Views: A View Mechanism for Integrating Heterogeneous Models - ER 2015 @ ...
 
ER 2015 EMFViews
ER 2015 EMFViewsER 2015 EMFViews
ER 2015 EMFViews
 
Boosting productivity with "Plone-driven Plone development"
Boosting productivity with "Plone-driven Plone development"Boosting productivity with "Plone-driven Plone development"
Boosting productivity with "Plone-driven Plone development"
 
Lightweight Model-Driven Engineering
Lightweight Model-Driven EngineeringLightweight Model-Driven Engineering
Lightweight Model-Driven Engineering
 
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in Nantes
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in NantesMoDisco & ATL - Eclipse DemoCamp Indigo 2011 in Nantes
MoDisco & ATL - Eclipse DemoCamp Indigo 2011 in Nantes
 
A Program Transformation Technique To Support AOP Within C Template
A Program Transformation Technique To Support AOP Within C   TemplateA Program Transformation Technique To Support AOP Within C   Template
A Program Transformation Technique To Support AOP Within C Template
 
Introduction to C3.net Architecture unit
Introduction to C3.net Architecture unitIntroduction to C3.net Architecture unit
Introduction to C3.net Architecture unit
 
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
 
Rust and Eclipse
Rust and EclipseRust and Eclipse
Rust and Eclipse
 
OOAD-Unit1.ppt
OOAD-Unit1.pptOOAD-Unit1.ppt
OOAD-Unit1.ppt
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
Opensource gis development - part 5
Opensource gis development - part 5Opensource gis development - part 5
Opensource gis development - part 5
 
ALT
ALTALT
ALT
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
[SiriusCon 2018] A Bird's Eye View on Eclipse Sirius
[SiriusCon 2018]  A Bird's Eye View on Eclipse Sirius[SiriusCon 2018]  A Bird's Eye View on Eclipse Sirius
[SiriusCon 2018] A Bird's Eye View on Eclipse Sirius
 
On-device ML with TFLite
On-device ML with TFLiteOn-device ML with TFLite
On-device ML with TFLite
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
 

Último

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

Model-Driven Engineering: a bottom-up approach based on meta-programming (ELA-ES'2013)

  • 1. Model-Driven Engineering From code to models Jean-Michel Bruel LatinAmerican School on SE, Rio de Janeiro, July 2013 "To persuade me of the merit of your language, you must show me how to construct models in it." 1978 Turing Award Lecture
  • 2. July 2013 bruel@irit.fr 2 About this document…  Target audience  Master’s students  Basic knowledge in UML, Java, (Ruby)  Author  Professor at IUT de Blagnac (Technical Institute)  For all comments: bruel@irit.fr  More available here:  http://jmb.c.la python code Ruby code AspectJ code - Legend-
  • 3. July 2013 bruel@irit.fr 3 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 4. July 2013 bruel@irit.fr 4 What is it all about?  Understand metaprogramming  Apply it to understand MDE class BoutDeCode # "constructeur" def initialize(nom) @nom = nom end def bonjour puts "salut moi c'est " << @nom end end
  • 5. July 2013 bruel@irit.fr 5 What is it all about? (ctd.)
  • 6. July 2013 bruel@irit.fr 6 What is it all about? (ctd.)  Several possible usage:  Code Evolution  Dynamic Adaptation  example: self-healing  Notion of context or « mode »  Deployment on heterogeneous targets  etc.
  • 7. July 2013 bruel@irit.fr 7 What is it all about? (ctd.)  Another Python example
  • 8. July 2013 bruel@irit.fr 8 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 9. July 2013 bruel@irit.fr 9 Model or code?  Possible collaboration Model/Code:  code as "first class citizen"  XP  model as "first class citizen"  MDE  model => code  Code generation  code => model  Reverse engineering  sharing at same time code / model  Recent tools  models@runtime
  • 10. July 2013 bruel@irit.fr 10 Model or code (ctd.)?  Code generation  Advantages  productivity  quality  Maintainability  How  Files (e.g., XML)  annotations / markup  Limitations  "code is more read than written"
  • 11. July 2013 bruel@irit.fr 11 Model or code (ctd.)?  models@runtime  Advantages  Focus on design  More users in the loop  Knowledge acquisition and capitalization  How  Specific tools (e.g. Kermeta)  Dedicated libraries (e.g. PauWare)  Limitations  Too precise too early
  • 12. July 2013 bruel@irit.fr 12 Model or code (ctd.)?  profiles / DSL  profiles  adapt/refine the semantic (e.g., WPCP)  validation rules  Numerous tools  Domain Specific Languages (DSL)  Close to users  Initial work is important
  • 13. July 2013 bruel@irit.fr 13 Integrated approach  Apply programming techniques to models  languages to manipulate artefacts  languages to transform models  Study meta-programming  definitions  examples
  • 14. July 2013 bruel@irit.fr 14 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 15. July 2013 bruel@irit.fr 15 Why Meta?  Some thoughts  Why should we manipulate data and functions only (what about code itself)?  Some functionality "crosscut"  Extra-functional properties  // with metadata  "About …"  Data about data  e.g., HTML META tag
  • 16. July 2013 bruel@irit.fr 16 Definitions  Abstraction  "one thing that represents several real things equally well" (E.W. Dijkstra, 1967)  Model  System description  Built for a precise purpose  Usable to predict or analyze its behavior  Aspect (in modeling, not in AOP)  System view
  • 17. July 2013 bruel@irit.fr 17 Definitions (ctd.)  Metaprogramming:  Writing programs using programs  Several possible ways:  Code generation  Templates programming (e.g. C++)  Powerful languages (Java, Ruby, python)  Macros  etc.
  • 18. July 2013 bruel@irit.fr 18 Definitions (ctd.)  Reflection:  A language is called reflective if it allows:  introspection: possibility to analyze the language itself  intercession: possibility to modify the objects’ behavior at run-time  Examples  Smalltalk  Java  Ruby
  • 19. July 2013 bruel@irit.fr 19 Reflection  Different types  structural (object->class->metaclass->…)  operational (memory, resources, etc.)  Different timing  compilation time  load time  run time
  • 20. July 2013 bruel@irit.fr 20 Limitations  Low performance  Encapsulation broken
  • 21. July 2013 bruel@irit.fr 21 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 22. July 2013 bruel@irit.fr 22 Aspect-Oriented Programming (AOP)  Generalization of metaprogramming  Modularity, reusability, etc.  Cf. Ruby example
  • 23. July 2013 bruel@irit.fr 23 AOP (ctd.) http://www.dotnetguru.org
  • 24. July 2013 bruel@irit.fr 24 AOP (ctd.)  Classical usage:  Logging/Tracing  Exceptions management  Debugging/Tests  Assertions/Contracts/Constraints  Performances optimization  Change detection  Access Synchronization  Persistence  Security/login  Design patterns
  • 25. July 2013 bruel@irit.fr 25 AOP (ctd.)  Limitations  Aspect = code to be inserted at certain points in the application  Resulting code complicated  Difficult to test
  • 26. July 2013 bruel@irit.fr 26 Classes as objects  Class Manipulation  Avoid repetitive code  Find an object’ class  Modify a class dynamically
  • 27. July 2013 bruel@irit.fr 27 Avoid repetitive code  Example of accessors class BoutDeCode # "constructeur" def initialize(nom) @nom = nom end … end … # oups, j'ai oublié les accesseurs class BoutDeCode attr_accessor :nom end
  • 28. July 2013 bruel@irit.fr 28 Avoid repetitive code (ctd.)  Example of tests #test/person_test.rb require File.join(… 'person') require 'test/unit' class PersonTest < Test::Unit::TestCase def test_first_name p = Person.new('John','Doe',25) assert_equal 'John' p.first_name end def test_last_name p = Person.new('John','Doe',25) assert_equal 'Doe' p.last_name end … end
  • 29. July 2013 bruel@irit.fr 29 Find an object’ class  trivial for interpreted languages  dedicated libraries  Java : java.lang.reflect  .Net : System.Reflection
  • 30. July 2013 bruel@irit.fr 30 Find an object’ class
  • 31. July 2013 bruel@irit.fr 31 Modify a class  Dynamicity and adaptation  Example: method redefinition class Foo # déjà définie ailleur # la méthode foom est buggée # on la renomme au cas où alias :foom_BUG :foom # et on la redéfinit def foom … end end
  • 32. July 2013 bruel@irit.fr 32 AOP  Basic Concepts  Pointcut  Manipulable code element (e.g., function f)  Jointpoint  Precise activity (method call, constructors, etc.)  Advice  code to be activated (e.g., log)  Moment to activate (e.g., before)  Aspect weaving  Available for almost all languages  Can be seen as a particular model transformation
  • 33. July 2013 bruel@irit.fr 33 AspectJ  Pointcuts  call/execution  get/set  handler  initialization()  adviceexecution() // exemple de pointcut call(void Point.SetX(int))
  • 34. July 2013 bruel@irit.fr 34 AspectJ (pointcuts)  Method signature  Pointcuts combination  ||, &&, !  Naming possibility pointcut modified() : call(void Point.SetX(int)) || … call(void Point.SetX(int)) || call(void Point.SetY(int)) call(void Point.SetX(int))
  • 35. July 2013 bruel@irit.fr 35 AspectJ (pointcuts, ctd.)  Genericity  Even on pointcuts themselves  Existing primitive pointcuts  this  target  args cflow(modified()) call(void Point.Set*())
  • 36. July 2013 bruel@irit.fr 36 AspectJ (advices)  Link between pointcut & code  Possible Links:  before  after  around before(): modified() { System.out.println("modification!"); } link codepointcut
  • 37. July 2013 bruel@irit.fr 37 AspectJ (advices, ctd.)  parameters pointcut setXY(FigureElement fe, int x, int y): call(void FigureElement.setXY(int, int)) && target(fe) && args(x, y); after(FigureElement fe, int x, int y) returning: setXY(fe, x, y) { System.out.println(fe + " moved to ("); System.out.println(x + ", " + y + ")."); }
  • 38. July 2013 bruel@irit.fr 38 AOP (ctd.)  Ruby: require 'aspectr'
  • 39. July 2013 bruel@irit.fr 39 AOP (ctd.)
  • 40. July 2013 bruel@irit.fr 40 MDE Application  Same manipulation  No real dedicated support yet  A-QVT / A-ATL ?  Aspect code generation -> QVT/ATL?
  • 41. July 2013 bruel@irit.fr 41 MDE Application (ctd.)  Design patterns  "Aspectization" of design patterns  Use for model transformation
  • 42. July 2013 bruel@irit.fr 42 Patron Observer (java)  Figures example
  • 43. July 2013 bruel@irit.fr 43 Patron Observer (java, ctd.)  Pattern [Gamma, 1995] [java.util]
  • 44. July 2013 bruel@irit.fr 44 Patron Observer (java, ctd.)  What is observable? public abstract class FigureElement extends Observable{…}
  • 45. July 2013 bruel@irit.fr 45 Patron Observer (java, ctd.)  Who observes what?  A line observes "its" points public class Line extends FigureElement implements Observer{ Point p1,p2; public Line(Point origine, Point destination) { p1 = origine; p2 = destination; p1.addObserver(this); p2.addObserver(this); }
  • 46. July 2013 bruel@irit.fr 46 Patron Observer (java, ctd.)  Who observes what?  A figure observes everything public class Figure implements Observer { … public void addLine(line l){ this.ens.add(l); l.addObserver(this); } …
  • 47. July 2013 bruel@irit.fr 47 Patron Observer (java, suite)  What happens when a change occurs?  notifying public void setXY(int x, int y) { … setChanged(); this.notifyObservers(); }
  • 48. July 2013 bruel@irit.fr 48 Patron Observer (java, suite)  What happens when a change occurs?  Reacting (line example) public void update(Observable o, Object arg) { if (o==p1) System.out.print("modification de mon p1"); else System.out.print("modification de mon p2"); draw(); }
  • 49. July 2013 bruel@irit.fr 49 Patron Observer (java, suite)  What happens when a change occurs?  Reacting (figure example) public void update(Observable o, Object arg) { if (o instanceof Point) System.out.println("modif. d'un point"); else System.out.println("modif. d'une ligne"); ((FigureElement)o).draw(); }
  • 50. July 2013 bruel@irit.fr 50 Observer (AspectJ)  Either we stay close to the code  Modifying classes consequently  extends Observable  implements Observer  List all pointcuts  Members modification (e.g., setXY)  Coding advices  setChanged();  this.notifyObservers();  public void update() {}
  • 51. July 2013 bruel@irit.fr 51 Observer (AspectJ)  Either we "simulate"  List of pointcuts  Members modification (e.g., setXY)  Coding advices  observers management (internally)  Concrete and Abstract Aspect (generic)
  • 52. July 2013 bruel@irit.fr 52 Observer (AspectJ) [Inforsid2003]
  • 53. July 2013 bruel@irit.fr 53 MDE application  Design patterns  Use for model transformation  See Research papers
  • 54. July 2013 bruel@irit.fr 54 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 55. Xtext  Framework for DSL  Domain Specific Language  Integrated with Eclipse EMF  Allows automated generation of:  Parser/lexer (for code generation)  Ecore MM  Moels Import/export into EMF July 2013 bruel@irit.fr 55
  • 56. General principles  Example of target syntax July 2013 bruel@irit.fr 56
  • 57. General principles (ctd.)  Xtext project under Eclipse  Language name (for the DSL)  File Extension July 2013 bruel@irit.fr 57
  • 58. General principles (ctd.)  Files generated  The project itself  Grammar description  Constraints, behavior, …  User Interface .ui  Editor, « outline », code completion, …  Code generator .generator July 2013 bruel@irit.fr 58
  • 59. Grammar Description  Close to EBNF July 2013 bruel@irit.fr 59
  • 60. Framework generation  Using the generator  GenerateXXX.mwe  Project launching  Either as an eclipse plug-in  Either as an eclipse application July 2013 bruel@irit.fr 60
  • 61. Framework usage July 2013 bruel@irit.fr 61
  • 62. Model Manipulation  Writing code generator  Templates .xpt July 2013 bruel@irit.fr 62
  • 63. Model Manipulation (ctd.) July 2013 bruel@irit.fr 63
  • 64. MDE Motivation  Evolution of new technologies  Separation between domain and architecture  Algorithm stability  Know-how Capitalization  Design pattern  Domain Objects  => necessity to abstract from code July 2013 bruel@irit.fr 64
  • 65. MDA  Model-Driven Architecture  OMG  Notions of:  PIM: Platform Independent Model  PSM: Platform Specific Model  CIM: Computation Independent Model July 2013 bruel@irit.fr 65
  • 66. MDE  Model-Driven Engineering  More general than MDA  Less focus on architectures  Models as first-class citizen July 2013 bruel@irit.fr 66
  • 67. Basic Concepts  Models  Metamodels and levels  Language, syntax, semantic  Transformations July 2013 bruel@irit.fr 67
  • 68. Model  Model  Abstraction of a system  Designed for a defined purpose  Usable to predict/simulate/validate  Description vs. Specification  Description => existing system  Specification => expected system July 2013 bruel@irit.fr 68
  • 69. Model (ctd.)  Objectives  Deal with systems complexity  SoC  Formalize intuitive elements  Communication (inside/outside the team) July 2013 bruel@irit.fr 69
  • 70. Model (ctd.)  Diverse and numerous  Different life cycle  Level of abstraction  Viewpoints => multiplicity of models July 2013 bruel@irit.fr 70
  • 71. Model (ctd.)  Example of UML  Behavioral models  Analysis models  Data models  Communications models  … July 2013 bruel@irit.fr 71
  • 72. Model (ctd.)  Benefits of a « formal » representation  => notion of conformity  => notion of metamodel July 2013 bruel@irit.fr 72
  • 73. Metamodel and levels July 2013 bruel@irit.fr 73 Source : Jean Bézivin
  • 74. Metamodel (ctd.)  Examples  Programs  Process/Program/Grammar/EBNF  XML  Data/XML file/DTD/??  UML  Class/Class Diagram/UML/UML!! July 2013 bruel@irit.fr 74
  • 75. Metamodel (ctd.)  Instanciation / conformity  Class <-> Object  => instanciation  An object is a class instance  Model (M) <-> Metamodel (MM)  => conformity  A model is not an instance of a MM  A MM is not a model of the model July 2013 bruel@irit.fr 75
  • 76. Metamodel (ctd.)  OMG Vocabulary  MOF: Meta-Object Facility  Common MM  UML 2.0  CWM  QVT July 2013 bruel@irit.fr 76
  • 77. Metamodel (ctd.)  Comparison MOF/EBNF  BNF : Bakcus-Naur Form July 2013 bruel@irit.fr 77 -- Exemple des adresses US : <postal-address> ::= <name-part> <street-address> <zip-part> <name-part> ::= <personal-part> <last-name> <opt-jr-part> <EOL> | <personal-part> <name-part> <personal-part> ::= <first-name> | <initial> "." <street-address> ::= <opt-apt-num> <house-num> <street-name> <EOL> <zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL> <opt-jr-part> ::= "Sr." | "Jr." | <roman-numeral> | "" -- Exemple des adresses US : <postal-address> ::= <name-part> <street-address> <zip-part> <name-part> ::= <personal-part> <last-name> <opt-jr-part> <EOL> | <personal-part> <name-part> <personal-part> ::= <first-name> | <initial> "." <street-address> ::= <opt-apt-num> <house-num> <street-name> <EOL> <zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL> <opt-jr-part> ::= "Sr." | "Jr." | <roman-numeral> | ""
  • 78. Metamodel (ctd.)  Comparison MOF/EBNF (ctd.)  EBNF : Extended Bakcus-Naur Form July 2013 bruel@irit.fr 78 « conforms to »
  • 79. Metamodel (ctd.)  Comparison MOF/EBNF (ctd.) July 2013 bruel@irit.fr 79 MOF EBNF DSL for models DSL for syntax Metamodel Meta-syntax To write models To describe programming languages « Initiated » by OMG and then normalized by ISO Normalised by ISO
  • 80. Language, syntax, semantic  To start with…  Difference between data & information? July 2013 bruel@irit.fr 80 Data Information Representation of the information Element of knowledge Used to communicate Interpretation of the data e.g.: - June, 21 2013 - 2013 Summer day Same information e.g.: yersteday Context dependency
  • 81. Language, syntax, semantic  General concepts  To communicate we need one (or more) language(s)  A model (M) is not a language  But can be the description of a language  A metamodel (MM) neither July 2013 bruel@irit.fr 81
  • 82. Language, syntax, semantic  A language consists in  A syntactic notation  A set of legal elements (combination of terms)  An interpretation for these termes July 2013 bruel@irit.fr 82
  • 83. Language, syntax, semantic  Syntax  Set of rules for the basic notation  Semantic Domain  Set of interpretations for the notation  Semantic  « mapping » from syntax to semantic domain July 2013 bruel@irit.fr 83
  • 84. Examples  Syntax <Exp>::=<Number>| <Variable>| <Exp>+<Exp>|…  Semantic domain  Set of natural numbers  Semantic  Associating a natural number to each expression July 2013 bruel@irit.fr 84  Syntax  Semantic domain  Set of traces  Semantic  Trace log
  • 85. Syntax  Examples  Words, sentences, declarations, boxes, schemas, terms, modules, …  Different kinds  Graphical  Textual  Abstract  Concrete  Language for its representation  Textual => grammar  Graphical => graphs July 2013 bruel@irit.fr 85
  • 86. Semantic  Operational  Set of states and transitions between those states  Denotational  Math. function that transfer from one state to the other  Axiomatic  Logical properties on states July 2013 bruel@irit.fr 86
  • 87. Illustrations  Example: signification of « X = X+Y »  « at this point of the program X must contain the same value as X+Y »  X receive X+Y  What X+Y means?  => it depends on the semantic July 2013 bruel@irit.fr 87
  • 88. Example of the MIU system  Taken from [GEB,1989]  Problem: "can we produce MU?"  Rules  Considering an initial chain (MI)  And some production rules (or inference)  The alphabet has only 3 lettres (M,I,U)  r1: if a chain finishes by I we can add U  r2: if a chain is of form Mx we can create Mxx  r3: III can be replaced by U  r4: UU can be eliminated  Implicit rule: we can only do what is authorized! July 2013 bruel@irit.fr 88
  • 89. MIU (ctd.)  Illustration of the rules  r1: I ending => we can add U  MI -> MIU  r2: Mx => Mxx  MU -> MUU  MUI -> MUIUI  r3: III can be replaced by U  UMIIIU -> UMUU  r4: UU can be removed  MUUUI -> MUI July 2013 bruel@irit.fr 89
  • 90. MIU (ctd.)  Problem: can we get MU from MI?  Go ahead and try for a while  chains can be seen as theorem  Hence MU is a theorem that has to be proven  MI is an axiom  Notion of derivation (example for MUIIU :) MI (axiom) MII (r2) MIIII (r2) MIIIIU (r1) MUIU (r3) MUIUUIU (r2) MUIIU (r4) July 2013 bruel@irit.fr 90
  • 91. MIU (ctd.)  MUIIU can be "proven"  Some properties are "obvious": all theorems start with M, but no program can say it => difference between man and machine!  "it is possible for a machine to act unobservant, not for a human"  Difference between being in and out of the formal system  Playing with the rules => in  Asking why MU is not provable => out July 2013 bruel@irit.fr 91
  • 92. Formal systems  Being able to determine whether an expression is correct (well-formed)  Being complete (completeness)  Any correct expression should have a meaning  Being consistent  An expression cannot have different meanings  Both properties are complementary  BUT you cannot have both! (Gödel theorem) July 2013 bruel@irit.fr 92
  • 93. Formal verification  Undecidability of the correctness proof  Partial solution = test  Checking for errors  Not finding one doesn’t mean there is no one  State machines  model-checking  Problem of combinatory explosion  Formal proofs  theorem proving  More an helping system that a proof system July 2013 bruel@irit.fr 93
  • 94. Example of UML profiles  Possibility of language extension  Stereotypes  Tagged Values  OCL constraints July 2013 bruel@irit.fr 94 http://web.univ-pau.fr/~ecariou/cours/idm/cours-meta.pdf
  • 95. Example of UML profiles (ctd.)  profile for EJB  SysML  MARTE July 2013 bruel@irit.fr 95
  • 96. Transformations  Objectives  Models as « first level citizen »  Bridges between models  Basic principles  Going from a source model (Min) to a target model (Mout) July 2013 bruel@irit.fr 96
  • 97. Transformations (ctd.)  Basic mechanisms  Take informations from Min  Generate/modify informations into Mout  Link with maths  Bijection, morphisms, …  Formal description July 2013 bruel@irit.fr 97
  • 98. Transformations (ctd.)  MDA vocabulary  CIM : Computation Independent Model  E.g., UML Use Cases  PIM : Platform Independent Model  E.g., UML Class Diagram  PSM : Platform Specific Model  E.g., EJB model  PDM : Platform Description Model  E.g., AADL July 2013 bruel@irit.fr 98
  • 99. Transformations (ctd.)  General vocabulary  M2M : Model To Model  E.g., Class Diag. <-> E/R diag.  M2T : Model To Texte  E.g., Class Diag. -> Java code July 2013 bruel@irit.fr 99
  • 100. Transformations (ctd.)  What language for transformations?  M2T  Code generation  Mainly based on templates  E.g.: VTL, JET  M2M  Less popular  E.g.: QVT, ATL  « XSLT-like » July 2013 bruel@irit.fr 100
  • 101. Transformations (ctd.)  What language for transformations?  Endogenes  Same metamodel  E.g.: UML Statemachine / UML Classe diagrams  Exogenes  Different metamodels  E.g.: UML Statemachine / Petri nets July 2013 bruel@irit.fr 101
  • 102. Y Transformations (ctd.)  Usual term (« Y cycle ») July 2013 bruel@irit.fr 102 PIMPIM PSMPSM PDMPDM PIMPIM PDMPDM PSMPSM refinement refinement refinement projection codecode Code generation Retro- engineering
  • 103. Transformations (ctd.)  Quiz  Compilation: is it transformation?  Could you provide me an exogene transformation example? July 2013 bruel@irit.fr 103
  • 104. Basic tools  Eclipse  EMF (Eclipse Modeling Framework)  Framework for manipulating models  Persistence management  meta-meta-model: Ecore  GMF (Graphical Modeling Framework)  GEF (Graphical Editing Framework) July 2013 bruel@irit.fr 104
  • 105. Eclipse Modeling Framework  Input files  UML (Ecore-compatible tools)  Plugin UML2  Papyrus  Rational (.mdl)  XMI  Pb. With compatibility  Java annotated  @model July 2013 bruel@irit.fr 105
  • 107. ATL (Atlas Transformation Language)  French answer to QVT  Query/View/Transformation  OMG standard July 2013 bruel@irit.fr 107
  • 108. ATL (ctd.)  Example 1 July 2013 bruel@irit.fr 108
  • 109. ATL (ctd.)  Example 2  Taken from:  http://web.univ-pau.fr/~ecariou/cours/idm July 2013 bruel@irit.fr 109
  • 110. ATL example  Expected transformation July 2013 bruel@irit.fr 110
  • 111. ATL example (ctd.)  MM definition July 2013 bruel@irit.fr 111
  • 112. ATL example (ctd.)  MM definition (ctd.) July 2013 bruel@irit.fr 112
  • 113. ATL example (ctd.)  Transformations description  Header July 2013 bruel@irit.fr 113 module TransformationProxy; -- Module Template create OUT : ClientProxyServeur from IN : ClientServeur; module TransformationProxy; -- Module Template create OUT : ClientProxyServeur from IN : ClientServeur;
  • 114. ATL example (ctd.)  Transformations description  Server modification July 2013 bruel@irit.fr 114 rule LeServeur { from serveurSource : ClientServeur!Serveur to serveurCible : ClientProxyServeur!Serveur ( nom <- serveurSource.nom, connecteA <- ClientProxyServeur!Proxy.allInstances() ) } rule LeServeur { from serveurSource : ClientServeur!Serveur to serveurCible : ClientProxyServeur!Serveur ( nom <- serveurSource.nom, connecteA <- ClientProxyServeur!Proxy.allInstances() ) }
  • 115. ATL example (ctd.)  Transformations description  Clients modifications July 2013 bruel@irit.fr 115 rule Clients{ from clientSource : ClientServeur!Client to clientCible : ClientProxyServeur!Client ( nom <- clientSource.nom, utilise <- clientSource.utilise, connecteA <- proxy ), proxy : ClientProxyServeur!Proxy ( nom <- clientSource.nom + ClientServeur!Serveur.allInstances().first().nom, clientConnecte <- clientCible, serveurConnecte <- ClientProxyServeur!Serveur.allInstances().first(), implemente <- clientCible.utilise ) } rule Clients{ from clientSource : ClientServeur!Client to clientCible : ClientProxyServeur!Client ( nom <- clientSource.nom, utilise <- clientSource.utilise, connecteA <- proxy ), proxy : ClientProxyServeur!Proxy ( nom <- clientSource.nom + ClientServeur!Serveur.allInstances().first().nom, clientConnecte <- clientCible, serveurConnecte <- ClientProxyServeur!Serveur.allInstances().first(), implemente <- clientCible.utilise ) }
  • 116. ATL example (ctd.)  Transformations description  Interface modifications July 2013 bruel@irit.fr 116 rule Interfaces { from interSource : ClientServeur!Interface to interCible : ClientProxyServeur!Interface ( nom <- interSource.nom, estUtiliseePar <- interSource.estUtiliseePar, estImplementeePar <- (ClientProxyServeur!Proxy.allInstances() -> select (p | p.implemente = interCible).first()) ) } rule Interfaces { from interSource : ClientServeur!Interface to interCible : ClientProxyServeur!Interface ( nom <- interSource.nom, estUtiliseePar <- interSource.estUtiliseePar, estImplementeePar <- (ClientProxyServeur!Proxy.allInstances() -> select (p | p.implemente = interCible).first()) ) }
  • 117. MD* best practices  Reference  MD* Best Practices, Markus Völter, 2008. July 2013 bruel@irit.fr 117 http://www.voelter.de/data/articles/DSLBestPractices-Website.pdf
  • 118. July 2013 bruel@irit.fr 118 Content  Why learning MDE from code ?  Model or code  Metaprogramming  Aspect Oriented Programming  Model-Driven Engineering  Self-Adaptive Systems
  • 119. Ambient systems  Definition (what I mean):  Human beings + components + interactions  Physical entities of distributed software  Capable of interacting with their environment  With autonomous behavior  Able to self-adapt to their context  Problems:  Collection of components (interaction, emerging properties)  AI (decision taking, self-adaptation, etc.)  Environment and context (definition, monitoring)  Methods and tools for developing such systems July 2013 bruel@irit.fr 119
  • 120. Ambient systems (IRIT lab.) July 2013 bruel@irit.fr 120 120 Anytime Anywhere Anything 24h/24 7/7 Professionnal Private … Between PC Between people (PDA,…) Indoor/Outdoor Office, home, … Phone, mobile, … Intelligence Context analysis, self-adaptation. Reasoning and modeling… IC3, LILaC, SMAC, MACAO, SIG teams Natural Interaction Access to service as simple as possible: Gesture recognition, … ICHS team Monitoring System is aware of its environment. Cameras, micros, radars, RFID, … SAMoVA, VORTEX teams Ubiquity User can interact from anywhere, with Interconnected devices, sensors, … Dynamic, trusted, heterogeneous networks Distributed architectures Models ASTRE, SIERA teams
  • 121. Ambient Intelligent Entities  IRIT cross-cutting group  AmIE project:  2009/2014  Soft. & Hard. Platform  Based on scenarios  12 IRIT teams involved!  18,5 equivalent people  33 PhD students  Competitivity groups  AESE (Aeronautics, RT&E)  Cancer, Bio, Santé
  • 122. Scenarios  Intelligent Campus  Social aspects  Financial aspects  Different viewpoints  Students  Professors  Staff  Technical services  Home Supervision  Social aspects  Financial aspects  Different viewpoints  Patient  Medical staff  Relatives  Technicians  … 122July 2013 bruel@irit.fr
  • 123. Technical Institute of Blagnac July 2013 bruel@irit.fr 123  4 Departments  Computer science (INFO)  Maintenance & Industry (GIM)  Networks & Telecoms (R&T)  2A2M (Aide et Assistance pour le Monitoring et le Maintien à domicile)  Laboratoiries: 3 CNRS labs  IRIT (Institut de Recherche en Informatique de Toulouse)  LAAS (Laboratoire d’Analyse et d’Architecture des Systèmes)  LAPLACE (Laboratoire Plasma et Conversion d’Energie)
  • 124. Application context July 2013 bruel@irit.fr 124 [Ger@Home]
  • 125. Technical details  Static modules (nodes)  Sensors  Temperature (of the room)  Hydrometer  Luminosity  Webcam  Microphone & speaker (interaction)  Mobile module (arm of the user)  Temperature (of the user)  Accelerometer July 2013 bruel@irit.fr 125
  • 126. Technical details (cont.)  System monitoring:  1« Master pc » receiving all information from the nodes  Communication system: zigbee  Crossbow Technology Modules  Imote2 Processor Radio Board (IPR2400) et Imote2 Sensor Board (ITS400)  Nodes programming in .NET Micro Framework July 2013 bruel@irit.fr 126
  • 127. Problems  Number of potential actors involved  Number of disciplines involved  Importance of the human factor  Critical systems (human lives)  Security and privacy concerns  Complex modeling and development process July 2013 bruel@irit.fr 127
  • 128. General architecture  Context  Requirements  Vaguely defined  Very evolving  Multiple Technologies  Solution  Separate infrastructures and measures  Precise / Rewrite requirements (e.g. RELAX language)  Layer-based Architecture July 2013 bruel@irit.fr 128
  • 129. General architecture (cont.)  Layer-based Architecture July 2013 bruel@irit.fr 129
  • 130. General architecture (cont.)  Basics:  Abstraction of sensors  Data Schema independent from the hardware  Abstraction of processes  Web services definition  Encapsulating data access and processes  Abstraction of applications  Advantages:  Greater evolutivity (physical, hardware and software) July 2013 bruel@irit.fr 130
  • 132. Experimentation (cont.)  Context adaptation July 2013 bruel@irit.fr 132
  • 133. Conclusion  Don’t learn modelling, do models  Don’t hesitate to use your geek skills with models too July 2013 bruel@irit.fr 133
  • 134. July 2013 bruel@irit.fr 134 Useful links  Models  « On the Unification Power of Models », Jean Bézivin, Revue SoSyM, 4:2, 2005.  « Meaningful Modeling: What’s the Semantics of Semantics », David Harel & Bernhard Rumpe, Revue IEEE Computer 37:10, 2004.  MDE  OMG web site: http://www.omg.org/  Tools  Kermeta (http://www.kermeta.org/)  ATL (http://www.eclipse.org/m2m/atl/)
  • 135. July 2013 bruel@irit.fr 135 Useful links (ctd.)  Introspection & metaprogramming  http://www.polytech.unice.fr/~blay/ENSEIGNEMENT/LOG8/Meta- Programmer.pdf  http://www.enib.fr/info/gl2/cours/metaprog.pdf  Jean Bézivin. "On the Unification Power of Models", SoSyM 2005, 4(2).  AOP  http://www.eclipse.org/aspectj/  Ruby par l'exemple (O'Reilly)  Aspect-Oriented Modeling  http://aosd.net/  Xtext  http://wiki.eclipse.org/Xtext/GettingStarted  http://www.eclipse.org/Xtext/documentation/  « On the Unification Power of Models », Jean Bézivin, Revue SoSyM, 4:2, 2005.