On Metamodelling PhD studentship admittance examination June 21, 2004 Frédéric Fondement
Contents z Software engineering z Modelling z Metamodelling z A case study z Concluding remarks
© F. Fondement
-2-
June 21, 2004
Contents z Software engineering • Productivity gains • Production gains • Major lessons
z Modelling z Metamodelling z A case study z Concluding remarks
© F. Fondement
-3-
June 21, 2004
Productivity Gains in SE z Methodologies • • • • • • • • •
z Abstraction Techniques
SADT Fusion OMT Booch Catalysis RUP Fondue SEAM …
© F. Fondement
• Punched Cards • Assembly Code • Functional / Procedural Programming • Object-Oriented Programming • Patterns • Concurrent Programming • Component-Oriented Programming / Middleware • Design by Contracts • Aspect-Oriented Programming • Product Family Engineering • …
-4-
June 21, 2004
Consequence: Production Gains Complexity (LOC) 108
1983: ADA 83
107 106
Windows 2000
GSM Networks
1997: AOP 1972: SmallTalk
Nuclear Submarine Control
1994: GOF 1993: Booch 93
Packet Switching System
105 104
1991: CORBA
1959: ALGOL 1963: COBOL
Compilers
1965
Functionnal Procedural
1976: SADT 1975
1992: Catalysis 1992: Design By Contracts 1985
OO
1995
2005
Components
Age
Remark: A new paradigm needs around 10 years to be mature © F. Fondement
-5-
June 21, 2004
Major Lessons z SE Best Practices • • • • •
Reuse / Develop for reuse Refinement / Refactoring Prototyping Test / Verification Communication / Documentation
z Problems • Requirements change • Nokia: 50% changed after finalization ; 60% of them at least twice
• Platforms change • OS, Languages, Databases, Middleware, …
• Development technology change • Compilers, Code generators, Frameworks, …
• People change • Especially for systems developed 30 years ago !
© F. Fondement
-6-
June 21, 2004
Contents z Software engineering z Modelling • • • •
Models Refinements Each step Questions raised
z Metamodelling z A case study z Concluding remarks © F. Fondement
-7-
June 21, 2004
Models z Abstract away details • Use paradigms rather than technologies • Enhance productivity and production !
z Human friendly
• Different views of the same system
z Cheap to manipulate and maintain z Models at any abstraction level • Use cases, Business models, SDL, CCM, B, …
Used most of the time for z Documentation / communication z Analysis z Prototyping Often drawings out of sync with (code) reality ! © F. Fondement
-8-
June 21, 2004
SE with Model Refinements Model Driven Engineering (MDE)
Re f Re inem fac en tor ts i ng / s
“From contemplative to productive”
System System System System System
Abstraction
Code Generation
Platform Specificity
Code
© F. Fondement
-9-
June 21, 2004
MDE Step
System System
Proof
Prototype Test Cases Documentation
© F. Fondement
- 10 -
June 21, 2004
Questions Raised
Re f Re inem fac en tor ts i ng / s
z What language for describing systems ? • E.g. E-Banking
System System System System System
• From Use Cases… • …to Oracle Schema + EJB + JSP
• E.g. Subway • From Use Cases… • … to Wireless JavaCard
• …
z One unique language is not enough !
Code Generation
• Domain Specific Languages • Define YOURSELF the right level of abstraction !
Code
© F. Fondement
- 11 -
June 21, 2004
Contents z Software engineering z Modelling z Metamodelling • Principles • A Standard : the MOF • MOF layers
z A case study z Concluding remarks
© F. Fondement
- 12 -
June 21, 2004
Metamodel
z Metamodelling Language
DTD
MM «conform»
MyModel
«conform»
XML TS
• Models • Domain Specific Languages
Modelling TS
z Abstract Syntax for
>
XML
• Needs an Abstract Syntax (Metametamodel) • A Metametamodel is a Language • Should be possible to describe it by itself !
z Remark: for a CASE tool, data are models • UML, Music Scores, Equipment of Industrial Systems, … • Communication among CASE tools with models • Requires knowledge of the surrounding metamodel
• Metamodels structure model repositories as database schemas structure databases
© F. Fondement
- 13 -
June 21, 2004
The MOF
0.. *
/ Depends On
Model Element
0.. *
0.. * ordered
Contains
1.. *
Constrains 1.. *
Attaches To ordered 0.. *
Namespace
I mport
Tag
0.. *
Constraint
0.. *
Al iases
0.. *
0.. * 0.. *
Is Of Type
ordered 0.. *
Generalizes 0.. *
Typed Element
General izable Element
Feature
Constant
Structure Field
Parameter
1
Classi fier
Package
Behavioural Feature
Structural Feature
Association End
1
1
Refers To /Exposes 0..*
Association
Data Type
Class
Operation
Exception
Attribute
Reference 0.. *
0.. *
Can Raise
Primitive Type
Structure Type
© F. Fondement
Enumeration Type
Col lection Type
- 14 -
0.. * ordered
A lias Type
June 21, 2004
System System System System System
MOF : Layers Let’s take a simple example of metamodel «metamodel» DataBaseMM
Code Generation Code
«conforms» Element
NamedElement
TypedElement
name : string
typedElement *
A_type_typedElement 0..1 type
DataBase
dataBase
table
0..1 A_table_dataBase *
© F. Fondement
Table
table
column
Column
DataType
0..1 A_column_table * isPrimaryKey : boolean
- 15 -
June 21, 2004
MOF : Layers M3
Metametamodel
MOF Element
M2
typedElement
NamedElement
TypedElement
name : string
*
A_type_typedElement 0..1 type
DataBase
dataBase
table
table
Table
0..1 A_table_dataBase *
0..1
column
Column
Metamodel
DataType
A_column_table * isPrimaryKey : boolean
Match Teams PK
name
M1
PK,FK1 PK,FK2 PK PK
Team1 Team2 Place Date
Model
Score1 Score2
M0
Name France
Real Life
Switzerland Germany © F. Fondement
- 16 -
June 21, 2004
MOF : Layers M3
Metametamodel
MOF Element
M2
typedElement
NamedElement
TypedElement
name : string
*
A_type_typedElement 0..1 type
DataBase
dataBase
table
table
Table
0..1 A_table_dataBase *
0..1
column
Column
Metamodel
DataType
A_column_table * isPrimaryKey : boolean
Match Teams PK
name
M1
PK,FK1 PK,FK2 PK PK
Team1 Team2 Place Date
Model
Code Generation Code
Score1 Score2
M0
Name France
System System System System System
“Real” Life
Switzerland Germany © F. Fondement
- 17 -
June 21, 2004
MOF : Layers :Class supertype Generalizes
M3 objects…
name=Element
subtype container
:Class
M3
ModelElement
name=name
Generalizes
MOF
supertype
subtype :Class name=DataBase type
IsOfType type
:Association Generalizes
name=A_table_dataBase container Contents
IsOfType contents
Instance Of
:Attribute
Contents
supertype name=NamedElement
name : string
contents
String:DataType
container Contents contents
subtype
:AssociationEnd :Class
:AssociationEnd IsOfType type
name=Table
Element
M2 DataBase
dataBase
typedElement
NamedElement
TypedElement
name : string
*
A_type_typedElement 0..1 type
table
Table
0..1 A_table_dataBase *
table 0..1
Column
column
DataType
A_column_table * isPrimaryKey : boolean
M1
Match Teams PK
name
PK,FK1 PK,FK2 PK PK
Team1 Team2 Place Date Score1 Score2
© F. Fondement
- 18 -
June 21, 2004
MOF : Layers :Class supertype Generalizes
M3 objects… represent a M2 model !
container
:Class
M3
ModelElement
supertype
subtype :Class name=DataBase type
IsOfType type
:Association Generalizes
name=A_table_dataBase container Contents
IsOfType contents
Instance Of Meta Objects
:Attribute name=name
Generalizes
MOF
contents
Contents
supertype name=NamedElement
name : string
name=Element
subtype
String:DataType
container Contents contents
subtype
:AssociationEnd
:AssociationEnd
:Class IsOfType type
name=Table
Element
M2 DataBase
dataBase
typedElement
NamedElement
TypedElement
name : string
*
A_type_typedElement 0..1 type
table
Table
0..1 A_table_dataBase *
table 0..1
Column
column
DataType
A_column_table * isPrimaryKey : boolean
M1
Match Teams PK
name
PK,FK1 PK,FK2 PK PK
Team1 Team2 Place Date Score1 Score2
© F. Fondement
- 19 -
June 21, 2004
MOF : Layers :Class supertype Generalizes
M objects… represent a M model !
container
:Class
M3
ModelElement
supertype
subtype :Class name=DataBase type
IsOfType type
:Association Generalizes
name=A_table_dataBase container
String:DataType
container
Contents
IsOfType
subtype
Contents contents
contents
Instance Of Meta Objects
:Attribute name=name
Generalizes
MOF
contents
Contents
supertype name=NamedElement
name : string
name=Element
subtype
:AssociationEnd
:AssociationEnd
:Class IsOfType type
name=Table name:Column
Element
Teams:Table table
table
M2
name=Teams typedElement
NamedElement
TypedElement
name : string
*
dataBase A_table_dataBase
A_type_typedElement 0..1 type
Championship:DataBase name=Championship
DataBase
dataBase
table
Table
0..1 A_table_dataBase *
table 0..1
Column
column
DataType
table
name=name isPrimaryKey=true
A_column_table
type A_type_typedElement typedElement
dataBase A_table_dataBase
A_column_table * isPrimaryKey : boolean
column
M atch:Table name=M atch
table
column
Team1:Column
A_column_table name=Team1 isPrimaryKey=true
M1
Match Teams PK
name
PK,FK1 PK,FK2 PK PK
Team1 Team2 Place Date Score1 Score2
© F. Fondement
- 20 -
June 21, 2004
Contents z Software engineering z Modelling z Metamodelling z A case study z Concluding remarks
© F. Fondement
- 21 -
June 21, 2004
Step 1 : Use-Cases z Modelling a Genealogy website.
System System System System System Code Generation Code
z 1st: Requirement elicitation • I want a web application that shows me the family of somebody • • • •
Wife Husband Daughters Sons
• The Web application must let me enter family information • Could be captured more precisely in Use Cases and Sequence Diagrams…
© F. Fondement
- 22 -
June 21, 2004
System System System System System
Step 2 : Domain z Modelling a Genealogy website.
Code Generation Code
z 2nd: Business Model • A class diagram • Metamodel : UML core children
wife
Person 0..* 2
public String name public String surname public Gender gender
Gender
0..1
public String male public String female
0..1
parents
husband public Marriage marry(Person person) Marriage public Date date
© F. Fondement
- 23 -
June 21, 2004
Step 3 : Cinematic z Modelling a Genealogy website.
System System System System System Code Generation Code
z 3rd: Web site cinematic… • A DSL : Netsilon Hypertext
© F. Fondement
- 24 -
June 21, 2004
What is that new Model ? Collection Displayer
M1
System System System System System Code Generation Code
Default Decision
M0 Link Web File Value Displayer
© F. Fondement
- 25 -
June 21, 2004
Cinematic : Metamodel z Netsilon Hypertext Metamodel ModelElement
M2 WebElement
0..1
WebFile
*
1
* *
DefaultDecisionConstraint
© F. Fondement
DecisionCenter 0..1
DecisionConstraint
CollectionDisplayer
- 26 -
Linker
ValueDisplayer
June 21, 2004
System System System System System
Step 4: Data Management z Modelling a Genealogy website.
Code Generation Code
z 4th: Generate data management part of the web application • Automatic model transformation from the business model to web application hypertext model • Class Diagram -> Hypertext Model children
wife
Person 0..* public String name public String surname 2 public Gender gender
Gender
0..1
public String male public String female
0..1
parents
husband public Marriage marry(Person person) Marriage public Date date
© F. Fondement
- 27 -
June 21, 2004
Lasts steps : Platforms z Modelling a Genealogy website.
System System System System System Code Generation Code
z 5th: Choose platforms… • • • •
Now and only now ! JSP / MySQL Generate code Not much to develop here but automatable optimizations…
z 6th: Deploy ! • On server www.genealogy.com/family • On database server.genealogy.com named Family
© F. Fondement
- 28 -
June 21, 2004
After : Maintenance z Modelling a Genealogy website.
System System System System System Code Generation Code
z 7th A: Maintain ! • • • •
The application is victim of its success Platform have to be changed ! Servlet / Oracle Repeat phases • 5 : “Choose platform and generate code” • 6 : “Deploy” • (needs data migration)
© F. Fondement
- 29 -
June 21, 2004
After : Maintenance z Modelling a Genealogy website.
System System System System System Code Generation Code
z 7th B: Maintain ! • A new requirement appeared ! • Visibility restricted to one’s own family • Redesign appropriate phases • Guided by the upper layer
• Regenerate / Redeploy automatically
© F. Fondement
- 30 -
June 21, 2004
After : Maintenance z Modelling a Genealogy website.
System System System System System Code Generation Code
z 7th C: Maintain ! • • • •
Your system must interoperate with other systems ! Remote calls from CORBA Select a new platform (CORBA) Regenerate / Redeploy automatically
© F. Fondement
- 31 -
June 21, 2004
Contents z Software engineering z Modelling z Metamodelling z A case study z Concluding remarks • Who is involved • What is Metamodelling • What is NOT Metamodelling
© F. Fondement
- 32 -
June 21, 2004
Who is Involved ? z Actors • Domain specialists • SE Method developers • NOT system developers
z Developed once, often used • There are much more programs than languages !
© F. Fondement
- 33 -
June 21, 2004
What is Metamodelling z Make models machine friendly beside human friendly • Enables tool interoperability at model level • A first step for automating (at least partially) incremental and reactive refinements
z Define an ontology for a class of models • • • • •
Vocabulary (terms) Taxonomy (relations between terms) Notation (model depicting) Epistemology (what is represented) + Semantics Can define extension mechanisms (profiles)
© F. Fondement
- 34 -
June 21, 2004
Needs More Maturity z Make models machine friendly beside human friendly • Enables tool interoperability at model level • A first step for automating (at least partially) incremental and reactive refinements
z Define an ontology for a class of models • • • • •
Vocabulary (terms) Taxonomy (relations between terms) Notation (model depicting) Epistemology (what is represented) + Semantics Can define extension mechanisms (profiles)
Unfortunately, standards are not going that far… at the moment ! © F. Fondement
- 35 -
June 21, 2004
What is Not Metamodelling z Defining relationship among models • Model Transformation • Bidirectional • Traceable • Defined on metamodels
• Code • Generation • Reverse • May be linked to Concrete Syntax definition – E.g. there are metamodels for Java
© F. Fondement
- 36 -
June 21, 2004
Thank you for your attention ! z Any question ?
© F. Fondement
- 37 -
June 21, 2004
Annexes z Variability z A Typical Variability Example z The Fondue Toolset Architecture z MOF Model Interchange z Ontology Overview
© F. Fondement
- 38 -
June 21, 2004
Software Lifecycle and Variability zRequirement elicitation zAnalysis / Design zImplementation zVerification / Test zDeployment
zMaintenance
© F. Fondement
Nokia: z50% changes after “frozen” z60% of these changes at least twice zCompilers zFrameworks zMiddleware zDatabases zApplication server zHardware zDuring years (e.g. bank and insurance companies) zTurnover zPrevious variabilities - 39 -
June 21, 2004
Typical Example PACBASE
OS/390
Bank DB2
J2EE
Internet z Hard to reuse z Hard to reverse z Hard to maintain
Applet E-Banking Web Browser
© F. Fondement
- 40 -
June 21, 2004
Fondue Builder Architecture Overview FONDUE EDITOR
OBJECTS EDITOR FONDUE CERTIFIER FONDUE REPOSITORY (JMI Repository)
IMPORT EXPORT
XMI SERIALIZER FONDUE ANIMATOR XMI File
© F. Fondement
- 41 -
June 21, 2004
MOF : Model interchange (XMI) Model interchange is standardized Should take into account models of any kinds (of any metamodel) XMI is XML => it needs a schema > Schema is given by the M(X+1) level ! DTD
• XMI is a language template
MM «instanciate»
MyModel
«conforms to»
XMI
z Remark • • • •
3 versions of XMI (1.0, 1.1, 1.2) Many versions of metamodel (UML : 0.9, 1.0, 1.3, 1.4, 2.0…) Tools interpret the XMI standard as they wish ! XMI possibilities for a same model (of a given metamodel) : Cartesian product of • XMI version • Metamodel version • Tool
© F. Fondement
- 42 -
June 21, 2004
XML TS
• Tools generate a DTD from a metamodel • Tools load / store models from / to XMI • An “XMI model” is valid for a given metamodel
Modeling TS
z z z z
Ontology Overview z Describes • Vocabulary: set of terms • Taxonomy: relationships between terms (parent / child, …) • Thesaurus: equivalences between terms
z Usages – Jasper R. and Uschold M. • • • •
Neural authoring: knowledge of an expert system Specification: core of a tool (Poseidon, Fondue Toolset, …) Common access to information: interoperability (tools, DBs, …) Ontology-Based Search: data mining (Semantic Web, …)
z Layers • L0: Objects described by an ontology • L1: The ontology itself • L2: The language for describing ontology (OWL, IDL, KAON, …)
© F. Fondement
- 43 -
June 21, 2004
Ontology Overview
L2
M3 M2 M1 M0
L2
L2-L1
L2-L1-L0
The Metametamodelling ontology
L1
L0
L1
L0
The Metamodelling ontology
L0
Modelling (metamodelling)
Data Management (semantic web, warehousing,…) © F. Fondement
- 44 -
June 21, 2004