1. Putting Engineering into MDE
Components and contracts for models
and transformations
Steffen Zschaler
29 September, 2014
With (lots of) help by
Francisco Duran, Jeffrey Terrell, Jendrik Johannes,
Dimitris Kolovos, and many others
All errors my own!
2. Motivation
• MDE is beginning to see some use
– Automotive
– Telecommunications
– Enterprise systems (especially for quality prediction)
• Need for systematic engineering
– To deal with scale of models
– To deal with complexity of domains
– To ensure correctness so MDE techniques can be
relied on
29/09/2014 (c) Steffen Zschaler 2
3. Motivation (2)
• Elements of systematic MDE engineering
– Requirements
– Architectures
– (Reusable) Components
– Patterns and Architecture Styles
– Methods and Guidelines
A research agenda for the years to come
29/09/2014 (c) Steffen Zschaler 3
4. Motivation (2)
• Elements of systematic MDE engineering
– Requirements
– Architectures
– (Reusable) Components
– Patterns and Architecture Styles
– Methods and Guidelines
A research agenda for the years to come
29/09/2014 (c) Steffen Zschaler 3
5. A framework for discussing
composition
29/09/2014 (c) Steffen Zschaler 4
Uwe Aßmann: Invasive Software Composition.
6. A framework for discussing
composition
Component Model
(incl. contracts)
29/09/2014 (c) Steffen Zschaler 4
Uwe Aßmann: Invasive Software Composition.
7. A framework for discussing
composition
Composition Model
(composition technique)
Component Model
(incl. contracts)
29/09/2014 (c) Steffen Zschaler 4
Uwe Aßmann: Invasive Software Composition.
8. A framework for discussing
composition
Composition Language
Composition Model
(composition technique)
Component Model
(incl. contracts)
29/09/2014 (c) Steffen Zschaler 4
Uwe Aßmann: Invasive Software Composition.
9. A framework for discussing
composition
Composition System
Composition Language
Composition Model
(composition technique)
Component Model
(incl. contracts)
29/09/2014 (c) Steffen Zschaler 4
Uwe Aßmann: Invasive Software Composition.
22. Model components
Contracts?
• Only syntactical, if any
– Meta-classes of elements expected
– Naming and signatures of operations
• Key exception: Rely-Guarantee
Specifications
– For temporal logic and state machines
29/09/2014 (c) Steffen Zschaler 9
37. Transformation Composition
Sequential
Class Model OO to Relational Table Model
Normalised
Table Model
Normalisation
29/09/2014 (c) Steffen Zschaler 13
38. Transformation Composition
Parallel
:Table
*
<<hook>>
:Column
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
39. Transformation Composition
Parallel
:Table
:Class *
<<hook>>
:Column
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
40. Transformation Composition
Parallel
:Table
:Class *
<<hook>>
:Column
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
41. Transformation Composition
Parallel
:Table
:Class *
<<hook>>
:Column
<<anchor>>
:Column
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
42. Transformation Composition
Parallel
:Table
:Class *
<<hook>>
:Column
<<anchor>>
:Column
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
43. Transformation Composition
Parallel
:Table
:Class
super
sub
:Class *
<<hook>>
:Column
<<anchor>>
:Column
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
44. Transformation Composition
Parallel
<<anchor>><<slot>>
:Table
*
<<hook>>
:Column
<<anchor>>
:Column
:Class
super
sub
:Class
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
45. Transformation Composition
Parallel
<<anchor>><<slot>>
:Table
*
<<hook>>
:Column
<<anchor>>
:Column
<<anchor>><<slot>>
:Table
*
<<hook>>
:Column
:Class
super
sub
:Class
:Attribute
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
46. Transformation Composition
Parallel
Weaving
<<anchor>><<slot>>
:Table
*
<<hook>>
:Column
<<anchor>>
:Column
<<anchor>><<slot>>
:Table
*
<<hook>>
:Column
:Class
super
sub
:Class
:Attribute
Weaving
Based on Jendrik Johannes, Steffen Zschaler, Miguel A. Fernández, Antonio Castillo, Dimitrios S. Kolovos, Richard F. Paige:
Abstracting Complex Languages through Transformation and Composition. MODELS 2009, LNCS 5795, pp 546–550.
47. Transformation Composition
Superimposition
module Class2Relational;
create OUT : Relational from IN : Class;
rule Class2Table {
Based on Lawley, M., Duddy, K., Gerber, A., Raymond, K. Language Features for Re-Use and Maintainability of MDA Transformations. OOPSLA &
GPCE Workshop, 2004
and: Jouault, F. and Kurtev, I. Transforming models with ATL. In: Satellite Events at the MoDELS 2005 Conference, Oct 2005, Montego Bay, Jamaica.
pp. 128-138, LNCS 3844 (long version from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.6117&rep=rep1&type=pdf )
from
c : Class!Class
to
out : Relational!Table (
name <- c.name,
col <- Sequence {key}
->union(c.attr)),
key : Relational!Column (
name <- 'objectId',
type <- objectIdType)
}
rule Attribute2Column {
from
a : Class!Attribute
to
out : Relational!Column (
name <- a.name,
type <- a.type)
}
29/09/2014 (c) Steffen Zschaler 15
48. Transformation Composition
Superimposition
module Class2Relational;
create OUT : Relational from IN : Class;
rule Class2Table {
module Class2RelationalInheritance;
create OUT : Relational from IN : Class;
rule Class2Table {
Based on Lawley, M., Duddy, K., Gerber, A., Raymond, K. Language Features for Re-Use and Maintainability of MDA Transformations. OOPSLA &
GPCE Workshop, 2004
and: Jouault, F. and Kurtev, I. Transforming models with ATL. In: Satellite Events at the MoDELS 2005 Conference, Oct 2005, Montego Bay, Jamaica.
pp. 128-138, LNCS 3844 (long version from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.6117&rep=rep1&type=pdf )
from
c : Class!Class
to
out : Relational!Table (
name <- c.name,
col <- Sequence {key}
->union(c.attr)),
key : Relational!Column (
name <- 'objectId',
type <- objectIdType)
}
rule Attribute2Column {
from
a : Class!Attribute
to
out : Relational!Column (
name <- a.name,
type <- a.type)
}
from
c : Class!Class (
c.parent.oclIsUndefined())
to
out : Relational!Table (
name <- c.name,
col <- Sequence {key}
->union(c.flattenedFeatures)),
key : Relational!Column (
name <- 'objectId',
type <- objectIdType)
}
-- flattenedFeatures helper not shown.
-- It collects all features of a class
-- and all its sub-classes
29/09/2014 (c) Steffen Zschaler 15
49. Transformation Composition
Superimposition
module Class2Relational;
create OUT : Relational from IN : Class;
rule Class2Table {
Based on Lawley, M., Duddy, K., Gerber, A., Raymond, K. Language Features for Re-Use and Maintainability of MDA Transformations. OOPSLA &
GPCE Workshop, 2004
and: Jouault, F. and Kurtev, I. Transforming models with ATL. In: Satellite Events at the MoDELS 2005 Conference, Oct 2005, Montego Bay, Jamaica.
pp. 128-138, LNCS 3844 (long version from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.6117&rep=rep1&type=pdf )
from
c : Class!Class
to
out : Relational!Table (
name <- c.name,
col <- Sequence {key}
->union(c.attr)),
key : Relational!Column (
name <- 'objectId',
type <- objectIdType)
}
rule Attribute2Column {
from
a : Class!Attribute
to
out : Relational!Column (
name <- a.name,
type <- a.type)
}
(
c.parent.oclIsUndefined())
to
out : Relational!Table (
name <- c.name,
col <- Sequence {key}
->union(c.flattenedFeatures)),
key : Relational!Column (
name 'objectId',
type <- objectIdType)
}
-- flattenedFeatures helper
-- not shown...
29/09/2014 (c) Steffen Zschaler 15
52. Contracts
• Need both syntactical and semantic
contracts
• Goal:
– Be precise enough to enable reasoning and
give assurances
– Be lenient enough to maximise reusability
29/09/2014 (c) Steffen Zschaler 17
53. Contracts (2)
Will look at two types of contracts:
– Syntactic contracts for sequential composition
(aka model typing)
– Semantic contracts for rule weaving
29/09/2014 (c) Steffen Zschaler 18
54. Contracts for sequential
composition
Class Model OO to Relational Table Model
• Contracts specify the kinds of models
read and written by a transformation
• Options:
1. Meta-models
2. Effective meta-models
3. Model types / Concepts
Normalised
Table Model
Normalisation
29/09/2014 (c) Steffen Zschaler 19
55. Model typing problems
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
56. Model typing problems
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
StateMachine
initialState
0..1
State
name: String
Transition
event: String
containedState *
src
1
tgt
1
incoming
*
*
outgoing
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
57. Model typing problems
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
StateMachine
initialState
0..1
State
name: String
Transition
event: String
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Mandatory-start <: Simple and Mandatory-start Steel Simple
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
58. Model typing problems
Mandatory-start <:Steel Simple
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
StateMachine
initialState
0..1
State
name: String
Transition
event: String
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-start
Error: Allows passing in
Mandatory-start instance, but breaks it.
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
59. mmo NewSM (s : Simple) {
sm := new StateMachine () ;
sm.initialState += new State () ;
s += sm
}
Model typing problems
StateMachine
initialState
0..1
State
name: String
Transition
event: String
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Mandatory-start <: Simple and Mandatory-start Guy Simple
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
60. Mandatory-start <:Guy Simple
mmo NewSM (s : Simple) {
sm := new StateMachine () ;
sm.initialState += new State () ;
s += sm
}
Model typing problems
StateMachine
initialState
0..1
State
name: String
Transition
event: String
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-start
Over-restriction: Would work with
Mandatory-start instance, but cannot specify.
S. Zschaler: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity.
In VAO’14
61. Syntactic contracts:
Research challenges
• Type theory of transformations
– Including intrinsic and extrinsic contracts
• Static analysis of transformations
– Data flow analysis
• Tool support for managing and
checking transformation contracts
29/09/2014 (c) Steffen Zschaler 21
64. Contracts for rule weaving
• Morphisms over transformation
systems
– Both for parameter and bindings
• Define Properties of morphisms to
ensure semantics of weaving
– Behaviour reflection and preservation
Semantic contracts
29/09/2014 (c) Steffen Zschaler 23
65. Semantic contracts:
Research challenges
• Other semantic properties
– Allow some change of behaviour
– Express behaviour of base parametrised over
transformations to be woven
29/09/2014 (c) Steffen Zschaler 24
66. Semantic contracts:
Research challenges
• Other semantic properties
– Allow some change of behaviour
– Express behaviour of base parametrised over
transformations to be woven
M1 M2
τ
29/09/2014 (c) Steffen Zschaler 24
67. Semantic contracts:
Research challenges
• Other semantic properties
– Allow some change of behaviour
– Express behaviour of base parametrised over
transformations to be woven
M1 M2
τ
sem1 sem2
ζ
Γ1 Γ2
29/09/2014 (c) Steffen Zschaler 24
68. Semantic contracts:
Research challenges
• Other semantic properties
– Allow some change of behaviour
– Express behaviour of base parametrised over
transformations to be woven
M1 M2
τ(τ1, .. , τn)
f(ζ1, .. , ζn)
sem1 sem2
ζ
Γ1 Γ2
29/09/2014 (c) Steffen Zschaler 24
70. Research Agenda
• Need a calculus of transformation components
– What do they look like?
– What composition operations are there?
– What are contracts?
– What properties can we derive for composite transformations?
• Some work exists:
– See talk
– Megamodelling (e.g., MINNT for typing)
• But are still missing fundamental theory
29/09/2014 (c) Steffen Zschaler 26