Correct Reuse of Transformations is Hard to Guarantee (ICMT'16)
1. Correct Reuse of Transformations is
Hard to Guarantee
Rick Salay, Steffen Zschaler, and Marsha
Chechik
July 04, 2016
2. Transformations can increase productivity
Activity Productivity increased Not used
Use of model-to-model transformations 50.8% 24.6%
Code generation 67.8% 12.0%
Data from J. Hutchinson, J. Whittle, M. Rouncefield, S. Kristoffersen: Empirical Assessment of MDE in Industry. ICSE’11
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 2
3. Transformations can increase productivity
Activity Productivity increased Not used
Use of model-to-model transformations 50.8% 24.6%
Code generation 67.8% 12.0%
Data from J. Hutchinson, J. Whittle, M. Rouncefield, S. Kristoffersen: Empirical Assessment of MDE in Industry. ICSE’11
But transformations not used as much:
• Too difficult
• Too costly to develop
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 2
4. Opportunity: Transformation reuse
• Reusable transformations can address this
– Reduce difficulty
• Transformations as encapsulated components
• Information hiding
– No need to understand implementation details to reuse transformation
– Reduce cost
• Build new transformations by composing reusable building blocks
• No need to redevelop everything from scratch
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 3
5. Opportunity: Transformation reuse
• Reusable transformations can address this
– Reduce difficulty
• Transformations as encapsulated components
• Information hiding
– No need to understand implementation details to reuse transformation
– Reduce cost
• Build new transformations by composing reusable building blocks
• No need to redevelop everything from scratch
BUT: Only if we can ensure correct reuse of transformations !
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 3
6. Correct transformation reuse
1. What do we mean by it?
2. How do existing reuse mechanisms fit in?
3. Why is it difficult?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 4
7. Correct transformation reuse
1. What do we mean by it?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 4
8. Transformation Reuse
Needs a reuse mechanism
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 5
9. Transformation Reuse
Needs a reuse mechanism
1. Model type mapping:
• Transformation defined over a set of model types but applied to a
different set
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 5
Provided by engineer
10. Transformation Reuse
Needs a reuse mechanism
1. Model type mapping:
• Transformation defined over a set of model types but applied to a
different set
2. Derivation of reused transformation:
• Reuse will require some changes to the transformation
• At least
– Pre-processing of input models
– Post-processing of output models
• Possibly rewriting the transformation itself
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 5
Provided by engineer
Automatically by reuse mechanism
11. Example
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 6
s0 s1
s4s2
a
a a
b
b
b
b
s0 s1
s2
a
a
b
b b
minimize
A minimization transformation for state machines
12. Example (2)
• State machines are really just a particular kind of
typed graphs:
– Two types of nodes
– Edges with labels
• So, can we reuse minimize for arbitrary typed graphs
of this form?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 7
13. Example (3)
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 8
A B
DC
a
a a
b
b
b
b
A B
C
a
a
b
b b
minimize
A minimization transformation for typed graphs?
14. Example (3)
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 8
A B
DC
a
a a
b
b
b
b
A B
C
a
a
b
b b
minimize
A minimization transformation for typed graphs?
15. Transformation Intent
• Such reuse doesn’t preserve the intent of minimize
– Minimising state machines is based on assumptions about the
semantics of state machines
• Correct reuse requires intent preservation
– Across different meta-models (or model types)
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 9
16. Transformation Intent
• Such reuse doesn’t preserve the intent of minimize
– Minimising state machines is based on assumptions about the
semantics of state machines
• Correct reuse requires intent preservation
– Across different meta-models (or model types)
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 9
17. Example: Intent Candidates
1. Preserves well-formedness
2. Does model minimization
3. Does behavioural model minimization
4. Does state machine minimization
5. Does minimization using the implication table method
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 10
18. Example: Intent Candidates
2. Does model minimization
3. Does behavioural model minimization
4. Does state machine minimization
5. Does minimization using the implication table method
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 10
Too unspecific: Not worth reusing
19. Example: Intent Candidates
2. Does model minimization
3. Does behavioural model minimization
4. Does state machine minimization
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 10
Too unspecific: Not worth reusing
Too specific: Not reusable
20. Soundness and Completeness
• A reuse mechanism is
– Sound if
• It produces only reused transformations that preserve intent
– Complete if
• It can produce all intent-preserving reused transformations
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 11
21. Correct transformation reuse
2. How do existing reuse mechanisms fit in?
3. Why is it difficult?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 12
22. Correct transformation reuse
2. How do existing reuse mechanisms fit in?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 12
23. Existing Mechanisms
• Model (sub-)typing (Steel, Guy, …)
– Model type mapping:
• Implicit morphism established by name identity
– Transformation derivation:
• None needed, name-based access ensures reusability
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 13
24. Existing Mechanisms
• Model concepts (de Lara, Guerra, Rose, …)
– Model type mapping:
• Explicit bindings establish clan morphism
– Transformation derivation:
• Input / Output transformation or transformation rewriting
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 13
25. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
26. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
27. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
28. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
29. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
Cannot preserve I2
Unsound reuse
30. Model Sub-typing Example
04/07/2016
Steel, J., Jezequel, J.M.: On Model Typing. SoSyM 6(4) (2007) 401–413
F: “Takes as input a state machine and produces
a lookup table showing the correspondence
between the current state, an arriving event, and
the resultant state.“
(I1) Produce a tabular representation of all the
state-state transitions;
(I2) Produce a tabular representation of the state
machine (i.e., same set of traces as a table).
Can easily preserve I1 and I2
Incomplete reuse
31. Model Concepts Example
Person
+age: int
Player
+age: int
+level: int
ConceptMeta-model
Provides a set of rules for manually establishing
bindings between meta-models and concepts.
Allow multiple valid bindings for the same meta-
model and concept.
Likely complete reuse
Unsound reuse
Rose, L., Guerra, E., de Lara, J., Etien, A., Kolovos, D., Paige, R.: Genericity for Model Management Operations. SoSyM (2011)
de Lara, J., Guerra, E.: Towards the Flexible Reuse of Model Transformations: A Formal Approach Based on Graph Transformation. J. Logical and
Algebraic Methods in Programming 83(5{6) (2014) 427–458
32. Model Concepts Example
Person
+age: int
Player
+age: int
+level: int
ConceptMeta-model
Provides a set of rules for manually establishing
bindings between meta-models and concepts.
Allow multiple valid bindings for the same meta-
model and concept.
Likely complete reuse
Unsound reuse
Rose, L., Guerra, E., de Lara, J., Etien, A., Kolovos, D., Paige, R.: Genericity for Model Management Operations. SoSyM (2011)
de Lara, J., Guerra, E.: Towards the Flexible Reuse of Model Transformations: A Formal Approach Based on Graph Transformation. J. Logical and
Algebraic Methods in Programming 83(5{6) (2014) 427–458
33. Model Concepts Example
Person
+age: int
Player
+age: int
+level: int
a
ConceptMeta-model
Provides a set of rules for manually establishing
bindings between meta-models and concepts.
Allow multiple valid bindings for the same meta-
model and concept.
Likely complete reuse
Unsound reuse
Rose, L., Guerra, E., de Lara, J., Etien, A., Kolovos, D., Paige, R.: Genericity for Model Management Operations. SoSyM (2011)
de Lara, J., Guerra, E.: Towards the Flexible Reuse of Model Transformations: A Formal Approach Based on Graph Transformation. J. Logical and
Algebraic Methods in Programming 83(5{6) (2014) 427–458
34. Model Concepts Example
Person
+age: int
Player
+age: int
+level: int b
ConceptMeta-model
Provides a set of rules for manually establishing
bindings between meta-models and concepts.
Allow multiple valid bindings for the same meta-
model and concept.
Likely complete reuse
Unsound reuse
Rose, L., Guerra, E., de Lara, J., Etien, A., Kolovos, D., Paige, R.: Genericity for Model Management Operations. SoSyM (2011)
de Lara, J., Guerra, E.: Towards the Flexible Reuse of Model Transformations: A Formal Approach Based on Graph Transformation. J. Logical and
Algebraic Methods in Programming 83(5{6) (2014) 427–458
35. Intent Preservation of Existing Mechanisms
• Make no assertions about intent preservation
• Our analysis:
• Why?
– Sound and complete reuse has not been on the agenda so far
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 16
Soundness Completeness
Model (sub-)typing
Model concepts ~
36. Correct transformation reuse
3. Why is it difficult?
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 17
37. What’s difficult, then?
• Transformation semantics (and intents) depend on
– Syntax of source and target languages
• Can be aligned using standard morphism constructions
• Model typing and model concepts do this
– Semantics of source and target languages
• Can be in arbitrary relation to language syntax
• Expression depends on language syntax
• No easy mappings
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 18
38. Reuse in Special Cases
• Families of transformations
– Parametrising transformation intents and implementations with
language-specific predicates
– Reuse implies providing concrete predicates
– Proofs can be generalised sound implementations
– BUT Implementations will usually not be efficient
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 19
42. Example:
Model Minimizing Transformations
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 20
Generic algorithm works for all model types
for which the parameters can be defined
Sound and complete reuse mechanism
BUT: Very inefficient transformation
43. Reuse in Special Cases (2)
• Families of model types
– Restrict transformation reuse to a specific family of languages
• E.g., state-machine models
– Restricts semantic variability
– Allows more efficient reusable implementations
Future work
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 21
44. Conclusions / Outlook
• Semantics are key to correct transformation reuse
– Transformation intents
– Language semantics
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 22
45. Conclusions / Outlook
• Semantics are key to correct transformation reuse
– Transformation intents
– Language semantics
• Research challenges
1. Effective description of intents
2. Sufficient conditions for simple, correct transformation reuse within
families of modelling languages
3. Reuse calculus for specific classes of intents and transformations
4. Mechanisms and languages for constructing concrete, sound reuse
mechanisms for specific classes of intents
04/07/2016 Salay, Zschaler, Chechik: Correct Reuse of Transformations 22