Upload
elena-bullins
View
216
Download
1
Tags:
Embed Size (px)
Citation preview
Introduction to Introduction to Model-Model-Driven EngineeringDriven Engineering
Olivier Barais(Univ. Rennes 1 & INRIA)
Triskell Team @ IRISACampus de Beaulieu
F-35042 Rennes CedexTel : +33 299 842 541 Fax : +33 299 847 171
e-mail : [email protected]’après le cours de Jean-Marc Jézéquel
(or: Why I'd like write program that write (or: Why I'd like write program that write programs rather than write programs)programs rather than write programs)
Problématique du génie logiciel Problématique du génie logiciel aujourd’huiaujourd’hui
Olivier Barais 3
Modern Software ProblemsModern Software Problems
Importance of non-functional propertiesImportance of non-functional properties– distributed systems, parallel & asynchronousdistributed systems, parallel & asynchronous– quality of service quality of service : reliability, latency, performance...: reliability, latency, performance...
Flexibility of functional aspectsFlexibility of functional aspects: Product Lines: Product Lines– notion of notion of product lines product lines (space, time)(space, time)
Versions(Time)
Variants (Functionalities)
Timeto
Market!
Timeto
Market!1.1
1.2
1.01.0 1.0 1.0 1.0 1.0
1.1 1.1 1.1 1.1 1.1
1.2 1.2 1.2 1.2 1.2
1.3 1.3 1.3 1.3 1.3
1.4 1.4 1.4 1.4 1.4
Olivier Barais 4
Problems addressed in SEProblems addressed in SE 1960’s: Cope with inherent complexity of 1960’s: Cope with inherent complexity of
software (Correctness)software (Correctness)– Milestone: Floyd ‘Milestone: Floyd ‘assigning meaning to programs’assigning meaning to programs’
» More than 10 years to mature. More than 10 years to mature. Mature <> solved!Mature <> solved!
1965 1975 1985 1995 2005 Time
Size of« big »projects(LOC)
108
107
106
105
104 Compiler
Olivier Barais 5
Problems addressed in SEProblems addressed in SE 1970’s: Cope with project size1970’s: Cope with project size
– Milestone: Parnas, Yourdon: Milestone: Parnas, Yourdon: modularity & structuremodularity & structure » More than 10 years to matureMore than 10 years to mature
1965 1975 1985 1995 2005 Time
Size of« big »projects(LOC)
108
107
106
105
104 Compiler
Packet Switching System
Olivier Barais 6
Problems addressed in SEProblems addressed in SE 1980’s: Cope with variability in requirements1980’s: Cope with variability in requirements
– Milestone: Jackson, Meyer: Milestone: Jackson, Meyer: modelingmodeling, , object orientationobject orientation » More than 10 years to matureMore than 10 years to mature
1965 1975 1985 1995 2005 Time
Size of« big »projects(LOC)
108
107
106
105
104 Compiler
Packet Switching System
Nuclear Submarine Control
– Nokia’s GSM infrastructure:Nokia’s GSM infrastructure:»50% of requirements changed 50% of requirements changed
after after they were frozenthey were frozen »60% of these changed at least twice!60% of these changed at least twice!
Olivier Barais 8
Problems addressed in SEProblems addressed in SE 1990’s: Cope with distributed systems and 1990’s: Cope with distributed systems and
mass deployment:mass deployment:– Milestone: MS Milestone: MS (COM),(COM), Szyperski: Szyperski: product-lines &product-lines & componentscomponents
1965 1975 1985 1995 2005 Time
Size of« big »projects(LOC)
108
107
106
105
104 Compiler
Packet Switching System
Nuclear Submarine Control
GSM Network
Component = deployment unitComponent = deployment unit– focus on non-functional propertiesfocus on non-functional properties– installation/execution conceptinstallation/execution concept
»Explicit Explicit (contractual) (contractual) dependenciesdependencies»Configuration and connectionConfiguration and connection
Olivier Barais 9
OO approach:OO approach:Models and Components Models and Components
frameworksframeworks
• Guarantees ?Functional , synchronization, performance, QoS
• Changeable software, from distributed/unconnected sourceseven after delivery, by the end user
Olivier Barais 10
Problems addressed in SEProblems addressed in SE 2000’s: pervasive software integration, 2000’s: pervasive software integration,
accelerating technological changes accelerating technological changes (platforms)(platforms)
– Milestone: ?Milestone: ?
1965 1975 1985 1995 2005 Time
Size of« big »projects(LOC)
108
107
106
105
104 Compiler
Packet Switching System
Nuclear Submarine Control
GSM Network
Windows 2000
Olivier Barais 11
From the object as the From the object as the onlyonly one concept one concept– As e.g. in SmalltalkAs e.g. in Smalltalk
To a multitude of conceptsTo a multitude of concepts
Once upon a time…Once upon a time… software development looked simple software development looked simple
Design patternsDesign patterns
Collaborations
Required port Provided Port
<<Component>>Decoder
DecoderIReceiverI
DataIDataI
ComponentsComponentsCOM+DCOM
CORBAIIOP
MicrosoftC# & .Net
XMLSOAP
Sun’s Java & EJB
HTTPHTML
+ until the next ultimate middleware platform (~2005)
ProprietaryMiddleware(eg. automotive)
It's difficult -- in fact, next to impossible – for a large enterprise It's difficult -- in fact, next to impossible – for a large enterprise to standardize on a single middleware platform.to standardize on a single middleware platform. (R. Soley) (R. Soley)
MiddlewareMiddleware (middle war)
AspectsAspects
Olivier Barais 12
CollaborationsCollaborations
Objects should be as simple as possibleObjects should be as simple as possible– To enable modular understandingTo enable modular understanding
But then where is the complexity?But then where is the complexity?– It is in the way objects interact!It is in the way objects interact!– Cf. Collaborations as a Cf. Collaborations as a standalone diagram in UMLstandalone diagram in UML((T. Reenskaug’s works)
Olivier Barais 13
Design PatternsDesign Patterns Embody Embody architectural know-howarchitectural know-how of experts of experts As much about problems as about solutionsAs much about problems as about solutions
– pairs problem/solution in a contextpairs problem/solution in a context About non-functional forces About non-functional forces
– reusability, portability, and extensibility…reusability, portability, and extensibility… Not about classes & objects but Not about classes & objects but
collaborationscollaborations– Actually, design pattern applications Actually, design pattern applications areare parameterized parameterized
collaborationscollaborations
Olivier Barais 15
Middleware or Middle War?Middleware or Middle War?
COM+DCOM
CORBAIIOP
MicrosoftC# & .Net
XMLSOAP
Sun’s Java & EJB
HTTPHTML
No clear winner until now And probably not in the
near future Migration is expensive
and disruptive
The OMG tried to send in the ‘’blue helmets’’
with the MDA initiative
+ until the next ultimate middleware platform (~2005)
ProprietaryMiddleware(eg. automotive)
It's difficult -- in fact, next to impossible – for a large enterprise It's difficult -- in fact, next to impossible – for a large enterprise to standardize on a single middleware platform.to standardize on a single middleware platform. (R. Soley) (R. Soley)
Olivier Barais 16
Aspect Oriented ProgrammingAspect Oriented Programming Kiczales et al., ECOOP’97Kiczales et al., ECOOP’97
– MIT’s one of 10 key technologies for 2010MIT’s one of 10 key technologies for 2010 Encapsulation of cross-cutting concerns in OO Encapsulation of cross-cutting concerns in OO
programsprograms– Persistence, contract checking, etc.Persistence, contract checking, etc.
Weaving at some specific points (join points) in the Weaving at some specific points (join points) in the program executionprogram execution– Hence more than macros on steroidsHence more than macros on steroids
AspectJ for AOP in JavaAspectJ for AOP in Java– Some clumsiness in describing dynamic join pointsSome clumsiness in describing dynamic join points
What about Aspect Oriented Design ?What about Aspect Oriented Design ?
Olivier Barais 17
good modularitygood modularity
XML parsing in org.apache.tomcatXML parsing in org.apache.tomcat– red shows relevant lines of codered shows relevant lines of code– nicely fits in one boxnicely fits in one box
XML parsing
Olivier Barais 18
good modularitygood modularity
URL pattern matching in org.apache.tomcatURL pattern matching in org.apache.tomcat– red shows relevant lines of codered shows relevant lines of code– nicely fits in two boxes (using inheritance)nicely fits in two boxes (using inheritance)
URL pattern matching
Olivier Barais 19
problems like…problems like…
where is logging in org.apache.tomcatwhere is logging in org.apache.tomcat– red shows lines of code that handle logging red shows lines of code that handle logging – not in just one placenot in just one place– not even in a small number of placesnot even in a small number of places
logging is not modularized
Olivier Barais 20
AspectJ™ is…AspectJ™ is… a small and well-integrated extension to Javaa small and well-integrated extension to Java a general-purpose AO languagea general-purpose AO language
– just as Java is a general-purpose OO language just as Java is a general-purpose OO language freely available implementationfreely available implementation
– compiler is Open Sourcecompiler is Open Source includes IDE supportincludes IDE support
– emacs, JBuilder, Forteemacs, JBuilder, Forte user feedback is driving language designuser feedback is driving language design
– [email protected]@aspectj.org– [email protected]@aspectj.org
currently at 1..5.4 releasecurrently at 1..5.4 release
Olivier Barais 21
EExpected benefits of using AOPxpected benefits of using AOP
good modularity,good modularity, even for crosscutting concerns even for crosscutting concerns– less tangled codeless tangled code– more natural codemore natural code– shorter codeshorter code– easier maintenance and evolutioneasier maintenance and evolution
» easier to reason about, debug, changeeasier to reason about, debug, change
– more reusablemore reusable» library aspectslibrary aspects» plug and play aspects when appropriateplug and play aspects when appropriate
État de la pratiqueÉtat de la pratique
Olivier Barais 23
Des logiciels complexes...Des logiciels complexes... Logiciels de grande tailleLogiciels de grande taille
– des millions de lignes de codedes millions de lignes de code– des équipes nombreusesdes équipes nombreuses– durée de vie importantedurée de vie importante– des lignes de produitsdes lignes de produits– plateformes technologiques complexesplateformes technologiques complexes– évolution continueévolution continue
Logiciels complexesLogiciels complexes Logiciels critiquesLogiciels critiques ......
Olivier Barais 24
Évolution des acteursÉvolution des acteurs
scientifique
programmeur
utilisateur
ingénieurs logiciels
utilisateurs
Time
Olivier Barais 25
Oui, Oui, Oui, mais ...Oui, Oui, Oui, mais ...
La mentalité de "l'informaticien moyen" La mentalité de "l'informaticien moyen" a t elle radicalement évoluée ?a t elle radicalement évoluée ?
Du "Codeur", au "Programmeur", à l' "Ingénieur Logiciel", ...Du "Codeur", au "Programmeur", à l' "Ingénieur Logiciel", ...
L' "Ingénieur logiciel"L' "Ingénieur logiciel"– prouve-t-il ses programmes ?prouve-t-il ses programmes ?– maintient-il à jour la documentation, les spécifications ?maintient-il à jour la documentation, les spécifications ?
Olivier Barais 26
État de la pratiqueÉtat de la pratique
50 ans après les débuts de l'informatique,50 ans après les débuts de l'informatique,
pour "l'informaticien moyen"pour "l'informaticien moyen"
la seule chose importante dans le la seule chose importante dans le logiciel c'est ...logiciel c'est ...
le Code !le Code !
=> Ingénierie Dirigée par le code=> Ingénierie Dirigée par le code
Olivier Barais 27
L'industrie logicielle aujourd'huiL'industrie logicielle aujourd'hui
end users
componentdevelopers
architects
assemblers
standardizationorganization
toolvendorsapplication
testers
siteadministrators
componenttesters
middlewareproviders
Olivier Barais 28
middlewareproviders
end users
componentdevelopers
architects
assemblers
standardizationorganization
toolvendorsapplication
testers
siteadministrators
componenttesters
De nombreux acteurs
• des préoccupations différentes
• des métiers différents
• des compétences variées
• des outils variés
• différents éléments logiciels
Séparation des préoccupations
L'industrie logicielle aujourd'huiL'industrie logicielle aujourd'hui
Olivier Barais 29
Point de vue desPoint de vue des
locataireslocataires
Point de vue desPoint de vue des
plombiersplombiers
Point de vue desPoint de vue des
électriciensélectriciens
Point de vue desPoint de vue des
architectesarchitectes
Point de vue desPoint de vue des
paysagistespaysagistes
Point de vue duPoint de vue du
cadastrecadastre
Point de vue desPoint de vue des
assureursassureurs
Point de vue desPoint de vue des
pompierspompiers
Point de vue desPoint de vue des
notairesnotaires
Point de vue desPoint de vue des
promoteurspromoteurs
Séparations des préoccupationsSéparations des préoccupations
système
Olivier Barais 30
Point de vue duPoint de vue du
propriétairepropriétairePoint de vue duPoint de vue du
plombierplombier
Point de vue de l'Point de vue de l'
électricienélectricien
Point de vue duPoint de vue du
maçonmaçonPoint de vue de l'Point de vue de l'
architectearchitecte
Point de vue duPoint de vue du
cadastrecadastre
système
Utile même pourUtile même pourdes systèmes des systèmes "moins" complexes"moins" complexes
Séparations des préoccupationsSéparations des préoccupations
Olivier Barais 31
ProblématiqueProblématique
Complexité croissante des logicielsComplexité croissante des logiciels Séparations des préoccupationsSéparations des préoccupations Séparations des métiersSéparations des métiers Multiplicité des besoinsMultiplicité des besoins Multiplicité des plateformesMultiplicité des plateformes Évolution permanenteÉvolution permanente
Logiciel =Logiciel = Code ? Code ? Est-ce la solution ?Est-ce la solution ?
Olivier Barais 32
Multiples modèles d'un même Multiples modèles d'un même systèmesystème
modèlesmodèlespour les architectespour les architectes
modèlesmodèlespour les notairespour les notaires
modèlesmodèlespour lespour lespompierspompiers
système
modèlesmodèlespour lepour lecadastrecadastre
modèlesmodèlespour l'assureurpour l'assureurcadastrecadastre
modèlesmodèlespour les paysagistespour les paysagistes
modèlesmodèlespour les électricienspour les électriciens
modèlesmodèlespour les plombierspour les plombiers
modèlesmodèlespour les promoteurspour les promoteurs
Olivier Barais 33
Ingénierie Dirigée par leIngénierie Dirigée par le CodeCode ouou
Ingénierie Dirigée par lesIngénierie Dirigée par les ModèlesModèles ? ?
Telle est la question...
Olivier Barais 34
En attente En attente du code
En vérification
En attente du montant
carte insérée
code frappémauvais code
En distribution
code bon
En attente retrait carte
carte retirée
montant correct
montant incorrect
billets retirés
le compte de P.le distrib. la banquepaul
retirer 500 fr
débiter 500 fr
la carte de P.
lire n° compte
la reserve
retirer 500 fr sur le compte n
sortir 5 billets de 100 frprendre la carte
confirmer
Client1..4 0..*
titulaires
Consortium
Compte
numérosolde...
1..*
0..1
1
Banque
numéronom
Distributeur0..*
1
0..*
1..*
signataire1
0..*CarteBleue
CoderetraitMax
1..*
AcceptéPar>
le compte de paul
le distributeur la banque
la carte de P.
la reserve
paul
4 : débiter(500)1 : retirer 500 fr
2 : lire n° de compte
5 : confirmer
6 : sortir 5 billet de 100 fr
3 : retirer 500 fr sur compte n
le compte de paulle compte de paul
le distributeur la banque
la carte de P.
la reserve
paul
4 : débiter(500)1 : retirer 500 fr
2 : lire n° de compte
5 : confirmer
6 : sortir 5 billet de 100 fr
3 : retirer 500 fr sur compte n
ClientClient
AssurerLaMaintenance
AssurerLaMaintenance
TechnicienTechnicien
AjouterDesBillets
AjouterDesBillets Transporteur
DeBillets
DistributeurDeBilletDistributeurDeBillet
FaireUnVirementFaireUnVirement
RetirerDeLArgentRetirerDeLArgent
ConsulterSonCompteConsulterSonCompte
système
Olivier Barais 35
Oui, Oui, Oui, mais ...Oui, Oui, Oui, mais ...
pour "l'informaticien moyen"pour "l'informaticien moyen"
la seule chose importante dans le la seule chose importante dans le logiciel c'est ...logiciel c'est ...
le Code !le Code !
Olivier Barais 36
En attente En attente du code
En vérification
En attente du montant
carte insérée
code frappémauvais code
En distribution
code bon
En attente retrait carte
carte retirée
montant correct
montant incorrect
billets retirés
le compte de P.le distrib. la banquepaul
retirer 500 fr
débiter 500 fr
la carte de P.
lire n° compte
la reserve
retirer 500 fr sur le compte n
sortir 5 billets de 100 frprendre la carte
confirmer
Client1..4 0..*
titulaires
Consortium
Compte
numérosolde...
1..*
0..1
1
Banque
numéronom
Distributeur0..*
1
0..*
1..*
signataire1
0..*CarteBleue
CoderetraitMax
1..*
AcceptéPar>
le compte de paul
le distributeur la banque
la carte de P.
la reserve
paul
4 : débiter(500)1 : retirer 500 fr
2 : lire n° de compte
5 : confirmer
6 : sortir 5 billet de 100 fr
3 : retirer 500 fr sur compte n
le compte de paulle compte de paul
le distributeur la banque
la carte de P.
la reserve
paul
4 : débiter(500)1 : retirer 500 fr
2 : lire n° de compte
5 : confirmer
6 : sortir 5 billet de 100 fr
3 : retirer 500 fr sur compte n
ClientClient
AssurerLaMaintenance
AssurerLaMaintenance
TechnicienTechnicien
AjouterDesBillets
AjouterDesBillets Transporteur
DeBillets
DistributeurDeBilletDistributeurDeBillet
FaireUnVirementFaireUnVirement
RetirerDeLArgentRetirerDeLArgent
ConsulterSonCompteConsulterSonCompte
class Compte {private Vector opérations ;private int découvertMax ;private Client titulaire ;
public int lireSolde() { int r = 0 ;for (i=0;opérations.size();i++)
r = r = opérations.at(i).montant ;return r ; }
public void débiter( int montant ) { if (montant<=0
|| lireSolde()-montant < lireSolde)throw new Exception() ;
...}
class Compte {private Vector opérations ;private int découvertMax ;private Client titulaire ;
public int lireSolde() { int r = 0 ;for (i=0;opérations.size();i++)
r = r = opérations.at(i).montant ;return r ; }
public void débiter( int montant ) { if (montant<=0
|| lireSolde()-montant < lireSolde)throw new Exception() ;
...}
class Compte {private Vector opérations ;private int découvertMax ;private Client titulaire ;
public int lireSolde() { int r = 0 ;for (i=0;opérations.size();i++)
r = r = opérations.at(i).montant ;return r ; }
public void débiter( int montant ) { if (montant<=0
|| lireSolde()-montant < lireSolde)throw new Exception() ;
...}
class Compte {private Vector opérations ;private int découvertMax ;private Client titulaire ;
public int lireSolde() { int r = 0 ;for (i=0;opérations.size();i++)
r = r = opérations.at(i).montant ;return r ; }
public void débiter( int montant ) { if (montant<=0
|| lireSolde()-montant < lireSolde)throw new Exception() ;
...}
?
??
?
?
Olivier Barais 37
SynthèseSynthèse Des Modèles plutôt que du CodeDes Modèles plutôt que du Code
– Un modèle est la simplification/abstraction de la réalitéUn modèle est la simplification/abstraction de la réalité– Nous construisons donc des modèles afin de mieux comprendre les Nous construisons donc des modèles afin de mieux comprendre les
systèmes que nous développonssystèmes que nous développons– Nous modélisons des systèmes complexes parce que nous somme Nous modélisons des systèmes complexes parce que nous somme
incapables de les comprendre dans leur totalitéincapables de les comprendre dans leur totalité– Le code ne permet pas de simplifier/abstraire la réalitéLe code ne permet pas de simplifier/abstraire la réalité
Pourquoi modéliserPourquoi modéliser
Olivier Barais 39
Why modeling: master complexityWhy modeling: master complexity Modeling, in the broadest sense, is the Modeling, in the broadest sense, is the cost-effective use of cost-effective use of
something in place of something else for some cognitive something in place of something else for some cognitive purposepurpose. It allows us to use something that is . It allows us to use something that is simplersimpler, , safersafer or or cheapercheaper than reality instead of reality for some purpose. than reality instead of reality for some purpose.
A model represents reality for the given purpose; the model A model represents reality for the given purpose; the model is an abstraction of reality in the sense that it cannot is an abstraction of reality in the sense that it cannot represent all aspects of reality. This allows us to deal with represent all aspects of reality. This allows us to deal with the world in a simplified manner, avoiding the complexity, the world in a simplified manner, avoiding the complexity, danger and irreversibility of reality.danger and irreversibility of reality.
Jeff RothenbergJeff Rothenberg..
Olivier Barais 40
Modeling in Science & EngineeringModeling in Science & Engineering A Model is a A Model is a simplifiedsimplified representation of an representation of an aspectaspect of the World for a specific of the World for a specific purposepurpose
M0(the world)
M1(modelingspace) Is represented by
Specificity of Engineering:Model something not yet existing (in order to build it)
Specificity of Engineering:Model something not yet existing (in order to build it)
+Applicant()+ApplicantInfo()+MakeApplication()
-companyName : CString-experience : CString-reference1 : CString-reference2 : CString-reference3 : CString
Applicant
+Person()+PersonInfo()
-personID : unsigned long-surname : CString-givenName : CString-middleInitial : char-streetAddress : CString-postCode : CString-countryname : CString-eMailAddress : CString
Person
-is taught by
1
-teaches
0..*+CourseSession()+CourseSessionInfo()
-courseSessionID : unsigned long-courseDate : unsigned long-courseID : unsigned long-courseLocation : CString
CourseSession
+AppStatus()+AppStatusInfo()
-statusCode : char-statusName : CString
AppStatus
+CourseRegistration()+CourseRegistrationInfo()
-registrationDate : unsigned long-completionFlag : bool-confirmedDate : unsigned long
CourseRegistration
+Test()+TestInfo()
-testScore : unsigned long
Test
+Application()+ApplicationInfo()
-productNr : unsigned long-certificationLevel : unsigned long-applicationDate : unsigned long
Application
+PermittedStatusChange()+StatusChangeInfo()
-fromStatus : char-toStatus : char
PermittedStatusChange
+ExamSession()+ExamSessionInfo()
-examSession : unsigned long-examlocation : CString-examDate : unsigned long
ExamSession
-gives0..*
-is achieved1
-is made by
1
-makes
0..*
-allows change in
0..*
-has a
1..*
-is taken by1
-takes0..*
-is made by a1
-made a1..*
-is in1
-is filled by0..*
-uses
1
-is used in
0..*
-applies to a0..*
-is for a1
+Exam()+ExamInfo()
-examID : unsigned long-certificationLevel : unsigned long
Exam
+Employee()+GetCurrentAge()+EmployeeInfo()
-jobType : CString-roomNr : unsigned long-department : CString-division : CString-jobTitle : CString-manager : unsigned long-headsDept : CString-headsDivision : CString-mobileNr : CString-birthDate : unsigned long
Employee
+registrationform()
RegistrationForm
-uses**
ApplicantApplicantList PersonList
findApplicant()
ApplicationRegForm
Applicant()
findPerson()
addPerson()
addApplication()
Application()
MakeApplication()
ApplicationList
Olivier Barais 41
UML: one model, 4 main UML: one model, 4 main dimensions, multiple viewsdimensions, multiple views
Device
start()stop()
Operator<<Actor>>
0..*1 0..*1
controls
Class diagram
: Operator
: Device
start( )
stop( )
Sequence diagram
UseCase diagram
: Operator
ControllingSite RemoteSite
TCP/IP : Device
Implementation diagram
: Operator
Olivier Barais 51
Model and Reality in SoftwareModel and Reality in Software Sun Tse: Sun Tse: Do not take the map for the realityDo not take the map for the reality MagritteMagritte
Software Software Models: from contemplative to productiveModels: from contemplative to productive
Olivier Barais 52
Modeling Modeling andand WeavingWeaving
DesignModel
Use CaseModel
SecurityModel
QoSModel Business
Model
ObjectModel
TestModel
UIModel
PlatformModel
CodeModel
tester
Challenges:-Product Families-Reuse of Weaving Process-Automatic Weaving
Challenges:-Product Families-Reuse of Weaving Process-Automatic Weaving
Olivier Barais 53
Assigning Meaning to ModelsAssigning Meaning to Models If a UML model If a UML model is no longer is no longer just just
– fancy pictures to decorate your roomfancy pictures to decorate your room– a graphical syntax for C++/Java/C#/Eiffel...a graphical syntax for C++/Java/C#/Eiffel...
Then tools must be able to manipulate Then tools must be able to manipulate modelsmodels– Let’s make a model Let’s make a model of what a model is!of what a model is!– => => meta-modelingmeta-modeling
» & meta-meta-modeling..& meta-meta-modeling..
ConstraintNamespace
Package
GeneralizableElement
0..*
0..*+supertype
{ordered}0..*
+subtype
0..*
Generalizes
Classifier
Class AssociationDataType
Feature
BehavioralFeature StructuralFeature
Operation
AssociationEnd
Reference
0..*
1
+referent0..*
+referencedEnd1
RefersTo
MofAttribute
ModelElement
0..*0..1
+containedElement
{ordered}
0..*
+container
0..1
Contains
0..*
1..*
0..*
+constrainedElement
1..*Constrains
Olivier Barais 54
UML2 UML2 meta-model meta-model
(part.)(part.)
Olivier Barais 55
Zoom: commentsZoom: comments
Olivier Barais 56
GeneralizationsGeneralizations
Olivier Barais 58
The 4 layers in practiceThe 4 layers in practice
Olivier Barais 59
Comparing Abstract Syntax SystemsComparing Abstract Syntax Systems
Pascal LanguageGrammar
A specificPascal Program
A specificexecution
of a Pascal program
EBNF MOF
The UMLmeta-Model
A Specificphenomenon
corresponding toa UML Model
A SpecificUML Model
Technology #2(MOF + OCL)
M3
M2
M1
Technology #1(formal grammars
attribute grammars,etc.)
A XMLdocument
A XML DTDOr Schema
A XMLdocument
A XML DTDor Schema
Technology #3(XML Meta-Language)
KIFTheories
Upper LevelOntologies
Technology #4(Ontology engineering)
[XMI=MOF+XML+OCL]
+DescriptionLogics
+ConceptualGraphs+etc.
+ Xlink, Xpath, XSLT+ RDF, OIL, DAML+ etc.
(From J. Bézivin)
Olivier Barais 60
MDA: the OMG new visionMDA: the OMG new vision
"OMG is in the ideal position to "OMG is in the ideal position to provide the model-provide the model-based standardsbased standards that are necessary to that are necessary to extend extend integration beyond the middleware approachintegration beyond the middleware approach… Now … Now is the time to put this plan into effect. is the time to put this plan into effect. Now is the time Now is the time for the Model Driven Architecturfor the Model Driven Architecturee."."
Richard Soley & OMG staff, Richard Soley & OMG staff,
MDA Whitepaper Draft 3.2MDA Whitepaper Draft 3.2
November 27, 2000November 27, 2000
Olivier Barais 61
Mappings to multiple and Mappings to multiple and evolving platformsevolving platforms
COM+DCOM
CORBA C#.Net
XMLSOAP
JavaEJB HTTP
HTML
MOF & UML as the core
Organization assets expressed as models
Model transformations to map to technology specific platforms
Platform neutral models basedon UML & MOF
Platform neutral models basedon UML & MOF
Olivier Barais 62
The core idea of MDA:The core idea of MDA:PIMs & PSMsPIMs & PSMs
MDA modelsMDA models– PIMPIM: Platform Independent Model: Platform Independent Model
» Business Model of a system abstracting away the Business Model of a system abstracting away the deployementdeployement details of a systemdetails of a system
» Example: the UML model of the GPS systemExample: the UML model of the GPS system– PSMPSM: Platform Specific Model: Platform Specific Model
» Operational model including platform specific aspectsOperational model including platform specific aspects» Example: the UML model of the GPS system on .NETExample: the UML model of the GPS system on .NET
Possibly expressed with a UML profile (.NET profile for UML)Possibly expressed with a UML profile (.NET profile for UML)
– Not so clear about platform modelsNot so clear about platform models » Reusable model at various levels of abstractionReusable model at various levels of abstraction
CCM, C#, EJB, EDOC, …CCM, C#, EJB, EDOC, …
Olivier Barais 63
A PSM for our GPSA PSM for our GPS Here, the platform is .NETHere, the platform is .NET
Olivier Barais 64
How to go From PIM to PSM?How to go From PIM to PSM?
"just" weave the platform aspect !"just" weave the platform aspect ! How can I do that?How can I do that?
– Through Model transformationsThrough Model transformations– Now hot topic at OMG with RFP Q/V/TNow hot topic at OMG with RFP Q/V/T
» Query/View/TransformationQuery/View/Transformation
Olivier Barais 65
Weaving aspects into UML Weaving aspects into UML Models?Models?
It’s what Model Driven Architecture is about!It’s what Model Driven Architecture is about!
Requirements Analysis ArchitecturalDesign
DetailedDesign
Implementation Validation
Lifecycle
Modelingpoint of views
Proofs,QoS
Analysis,Simulation
Technical Aspects
BusinessAspects
Text(e.g. XML)
PIMPIM
Doc Doc Doc Doc Doc Doc
PIMPIM
PIMPIM
PSMPSM
PIMPIM
PSMPSM
CodeCode
TestsTests
Formal Models Formal Models
Endomorphic TransformationsExomorphic TransformationsOutside UML scope
PIM=Platform Independent ModelPSM= Platform Specific Model
Olivier Barais 66
But many more dimensions in But many more dimensions in modeling!modeling!
Beyond Design Model Beyond Design Model – where UML is arguably good…where UML is arguably good…
Business modelBusiness model GUI modelGUI model Development process modelDevelopment process model Performance & Resource modelPerformance & Resource model Deployment modelDeployment model Test modelTest model Etc.Etc.
Olivier Barais 67
How to take these dimensions How to take these dimensions into account?into account?
Expression with eitherExpression with either– UML, usUML, usinging built-in extension built-in extension
mechanisms to link with other mechanisms to link with other semantic domainssemantic domains
– DS(M)L, based on MOFDS(M)L, based on MOF ExploitationExploitation
– Weave all these aspects Weave all these aspects into a design modelinto a design model
– Define Define mappingsmappings between these between these aspects (as in e.g. aspects (as in e.g. federationsfederations))
Servicemodel
Domainmodel
Resourcemodel
DesignModel
Testmodel
Installationmodel
Olivier Barais 68
Element stereotype
Design pattern application(parametric collaboration)
Historycmd_executed : string
last_command() : string
<<persistent>>
ServiceProvider
<<command>> action_1()<<command>> action_2()<<command>> action_3()
Interpreter
execute()
0..*
1
0..*
11..*1..* 1..*
+invoker
1..*
…and alsoTagged values& Contracts
Command pattern
receiver
invoker
Embedding implicit semantics Embedding implicit semantics into a modelinto a model
Olivier Barais 69
……and the resultand the result we we wanwantt......
Historycmd_executed : string
last_command() : string
<<persistent>>
History_StorageProxy
load_last_command() : stringstore_last_command(cmd : string)
action_1_cmd
do()
action_2_cmd
do()
action_3_cmd
do()
ServiceProvider
<<command>> action_1()<<command>> action_2()<<command>> action_3()
+proxy
Interpreter
execute()
0..*
1
0..*
1
ServiceProvider_Command
do() 10..*
+cmdTarget
10..*1..*0..* 1..*
+commands
0..*
Olivier Barais 70
0..*
1
Historycmd_executed : string
last_command() : string
<<persistent>>
Interpreter
execute()
ServiceProvider
<<command>> action_1()<<command>> action_2()<<command>> action_3()
History_StorageProxy
load_last_command() : stringstore_last_command(cmd : string)
Persitence implementation
1..*0..*
ServiceProvider_Command
do() 10..*
action_3_cmd
do()
action_2_cmd
do()
action_1_cmd
do()
Command pattern implementation
How To: Automatic Model How To: Automatic Model TransformationsTransformations
In some domains (e.g.; RT systems)transformations can get more complexthan initial model!=> must be managed with sound SE principles
Olivier Barais 71
Why complex transformations?Why complex transformations? Example: Air Traffic ManagementExample: Air Traffic Management
– ““business model” quite stable & not that complexbusiness model” quite stable & not that complex Various modeling languages used beyond UMLVarious modeling languages used beyond UML
– As many points of views as stakeholdersAs many points of views as stakeholders Deliver software for (many) variants of a platformDeliver software for (many) variants of a platform
– Heterogeneity is the ruleHeterogeneity is the rule Reuse technical solutions across large product Reuse technical solutions across large product
lines (e.g. fault tolerance, security…)lines (e.g. fault tolerance, security…) Customize generic transformationsCustomize generic transformations Compose reusable transformationsCompose reusable transformations Evolve & maintain transformations for 15+ years!Evolve & maintain transformations for 15+ years!
Olivier Barais 72
The 3 ages of TransformationsThe 3 ages of Transformations Awk-like (inc. Awk-like (inc. sed, perlsed, perl…) …)
XSLTXSLT– W3C standard for transforming XMLW3C standard for transforming XML– Operates on tree structuresOperates on tree structures– syntactical & inefficientsyntactical & inefficient
QVT-likeQVT-like– Now hot topic at OMG with RFP Q/V/TNow hot topic at OMG with RFP Q/V/T
» Query/View/TransformationQuery/View/Transformation– Operates on graphsOperates on graphs
BEGIN {action)pattern #1 {action #1}…pattern #n {action #n}END {action)
SE Limit: ~100 LOC
SE Limit: ~1000 LOC
SE Limit: ?Standard?Which/When?
Olivier Barais 73
Transformations are AssetsTransformations are Assets=> apply sound SE principles=> apply sound SE principles
Must be ModeledMust be Modeled– with the UML, using the power of OOwith the UML, using the power of OO
Must be DesignedMust be Designed– Design by Contract, using OCLDesign by Contract, using OCL
Must be ImplementedMust be Implemented– Made available through libraries of components, frameworks…Made available through libraries of components, frameworks…
Must be TestedMust be Tested– test casestest cases
» input: a UML Modelinput: a UML Model» output: a UML Model, + contract checkingoutput: a UML Model, + contract checking
Must be Evolved Must be Evolved – Items of Configuration ManagementItems of Configuration Management– Transformations of transformationsTransformations of transformations
Olivier Barais 74
PrinciplesPrinciples
1.1. Everything relevant to the development Everything relevant to the development process is a modelprocess is a model
2.2. All the meta-models All the meta-models can becan be written in a written in a language of a unique meta-meta-modellanguage of a unique meta-meta-model
» Same M3 helps Interoperability of tools defined at M2Same M3 helps Interoperability of tools defined at M2
3.3. A development process can be modelled A development process can be modelled as a partially ordered set of model as a partially ordered set of model transformations, that take models as input transformations, that take models as input and produce models as outputand produce models as output
Olivier Barais 75
ConsequencesConsequences
1.1. Models are aspect oriented. Conversely: Models are aspect oriented. Conversely: Aspects are modelsAspects are models
2.2. Transformations are Transformations are aspects weavers. aspects weavers. They can be modeled.They can be modeled.
3.3. Every meta-model defines a domain Every meta-model defines a domain specific languagespecific language
4.4. Software development has two Software development has two dimensions: M1-model development and dimensions: M1-model development and M2-transformation developmentM2-transformation development
Olivier Barais 76
ChallengesChallenges Language definition problems (Q/V/T)Language definition problems (Q/V/T)
– Expressive, easy to use language(s) for transformationsExpressive, easy to use language(s) for transformations Technological IssuesTechnological Issues
– Tool set, interoperability…Tool set, interoperability… Software Engineering IssuesSoftware Engineering Issues
– From requirements to tests and SCMFrom requirements to tests and SCM Theoretical issuesTheoretical issues
– A transformation is a A transformation is a mappingmapping between semantic domains between semantic domains» Beyond Code Generation: Proof, Performance Evaluation, Test Beyond Code Generation: Proof, Performance Evaluation, Test
Synthesis …Synthesis …– Compositional weaving, cf. Aspect Oriented Software DCompositional weaving, cf. Aspect Oriented Software Dvpvp
Olivier Barais 77
UML & UML & MModelodel D Driven riven Architecture: SummaryArchitecture: Summary
Modeling to master complexityModeling to master complexity– Multi-dimensional and aspect oriented by definitionMulti-dimensional and aspect oriented by definition
Models: from contemplative to productiveModels: from contemplative to productive– Meta-modeling toolsMeta-modeling tools
Model Driven EngineeringModel Driven Engineering– Weaving aspects into a design modelWeaving aspects into a design model
» E.g. Platform SpecificitiesE.g. Platform Specificities
Model Driven Architecture (PIM / PSM): just a Model Driven Architecture (PIM / PSM): just a special case of Aspect Oriented Designspecial case of Aspect Oriented Design
Related: Generative Prog, Software FactoriesRelated: Generative Prog, Software Factories
Olivier Barais 78
Preview of the rest of this coursePreview of the rest of this course Meta-ModelingMeta-Modeling
– Meta-models & abstract syntaxesMeta-models & abstract syntaxes– Static Semantics with OCLStatic Semantics with OCL– Dynamic Semantics with KermetaDynamic Semantics with Kermeta
Model Driven Specification LanguageModel Driven Specification Language– The logo case studyThe logo case study
Model Transformations & code generationModel Transformations & code generation Applications of MDEApplications of MDE
– Design Pattern ApplicationDesign Pattern Application– Model RefactoringModel Refactoring– Product Line Modeling and DerivationProduct Line Modeling and Derivation