Design Patterns for Model Transformations Design Patterns for Model Transformations Proposal of Huseyin Ergin Committee Members : Dr. Eugene Syriani (advisor) Dr. Jeffrey C. Carver Dr. Jeff Gray Dr. Ralf Lmmel Dr. Randy K. Smith Department of Computer Science College of Engineering University of Alabama

Design Patterns for Model Transformations OUTLINE Background Related Work DelTa MT Design Patterns Planned Work Conclusion 2 Design Patterns for Model Transformations

BACKGROUND: MDE & MODEL TRANSFORMATION Language Engineering adapted to model-driven engineering [1] In MDE, models are primary artifacts of development.[2] [1] David Harel, Bernhard Rumpe, "Meaningful Modeling: What's the Semantics of "Semantics"?," Computer, vol. 37, no. 10, pp. 64-72, Oct. 2004, doi:10.1109/MC.2004.172 [2] Robert France and Bernhard Rumpe. 2007. Model-driven Development of Complex Software: A Research Roadmap. In 2007 Future of Software Engineering (FOSE '07). IEEE Computer Society, Washington, DC, USA, 37-54. DOI=10.1109/FOSE.2007.14 3 Design Patterns for Model Transformations MDE IN ACTION

The problem (from TTC 2014): Write a transformation that works on IMDb as a model and identify all actor or actress couples which perform together in a set of at least three movies.[1] Step 1: Choose the modeling environment. Environment: AToMPM[2] MTL: MoTif[3] Step 2: Design a metamodel. [1] http://www.transformation-tool-contest.eu/solutions/movie/ttc2014_submission_20.pdf [2] Syriani, E., Vangheluwe, H., Mannadiar, R., Hansen, C., Van Mierlo, S., and Ergin, H. (2013) Atompm: A web-based modeling environment. MODELS13: Invited Talks, Demos, Posters, and ACM SRC. CEUR-WS.org.

[3] Syriani, E. and Vangheluwe, H. A Modular Timed Model Transformation Language, Journal on Software and Systems Modeling, vol. 11, pp. 128, June 2011. 4 Design Patterns for Model Transformations MDE IN ACTION Step 3: Assign concrete syntax to elements. Step 4: Create models. 5 Design Patterns for Model Transformations

MDE IN ACTION Step 5: Design rules to solve the problem. NAC LHS RHS Step 6: Design the scheduling of the rules. 6

Design Patterns for Model Transformations MDE IN ACTION Step 7: Execute the transformation on the model. 7 Design Patterns for Model Transformations MDE IN ACTION Excerpts from solutions in other MTLs. GrGen.NET[1] FunnyQT [2]

e-Motions[3] [1] Gei, R. and Kroll, M. (2008) GrGen. net: A fast, expressive, and general purpose graph rewrite tool. Applications of Graph Transformations with Industrial Relevance, pp. 568569. Springer. [2] Tassilo Horn. Model querying with funnyqt - (extended abstract). In Keith Duddy and Gerti Kappel, editors, ICMT, volume 7909 of Lecture Notes in Computer Science, pages 5657. Springer, 2013. [3] Rivera, J.E., Duran, F., Vallecillo, A.: On the behavioral semantics of real-time domain specic visual languages. In: WRLA. pp. 174190 (2010) 8 Design Patterns for Model Transformations BACKGROUND: MDE & MODEL TRANSFORMATION MDE use models to describe complex systems at multiple level of

abstractions. A bridge vs. its built 1:100 prototype vs. its drawing on a paper. MDE Schema[1] [1] Jouault, F., Allilaire, F., Bzivin, J., and Kurtev, I. (2008) ATL: A model transformation tool. Science of Computer Programming, 72, 3139. 9 Design Patterns for Model Transformations BACKGROUND: MODEL TRANSFORMATION Relational vs. Graph-transformation-based [1] Relational (QVT, ATL etc.)

Usually specifies the correspondence between source and target elements. Focuses on a subset of model transformations. More restrictions on how to create the transformation. Input model is read-only and output model is write-only. Graph-transformation-based (MoTif, Henshin, Viatra2 etc.)

Works on graph structures that represent the models. Allows more flexibility like a general-purpose programming language. Allows in-place editing of models. Can have explicit scheduling structure. This study focuses on graph-transformation-based model transformations. [1] Czarnecki, K. and Helsen, S. (2006) Feature-Based Survey of Model Transformation Approaches. IBM Systems Journal, 45, 621645 10 Design Patterns for Model Transformations BACKGROUND: DESIGN PATTERNS Design pattern

describes a problem which occurs over and over again in our environment and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without every doing it the same way twice.[1] Hundreds of design patterns in different areas Software architecture, real-time systems, distributed computing, embedded networks, metamodeling, model transformations. Object-oriented design patterns are really popular among software developers. [1] Gamma, E., Helm, R., Johnson, R., and Vlissides, J. (1995) Design Patterns: Elements of Reusable Object-oriented Software. AddisonWesley, Boston, MA, USA. 11

Design Patterns for Model Transformations BACKGROUND: DESIGN PATTERNS Example Command Pattern [1] Intent: encapsulates a request as an object, lets requests to be passed as parameters and supports undoing. Structure: Limitations of Design Patterns Tradeoff between reusability vs efficiency. Not clear how many design patterns are optimal in a project. Too many design patterns can mess up the code. Applying a design pattern is not automated. [1] Gamma, E., Helm, R., Johnson, R., and Vlissides, J. (1995) Design Patterns: Elements of Reusable Object-oriented Software. AddisonWesley, Boston, MA, USA.

12 Design Patterns for Model Transformations 13 Design Patterns for Model Transformations RESEARCH PROBLEM Development of model transformation is still an error-prone and hard task. One reason is the lack of a development process. [1] Design it before implement it.

Software developers have been using UML. With help of GoF design patterns. Main goal of my thesis is: Helping model transformation developers in the design of model transformation through the use of design patterns. [1] Guerra, E., de Lara, J., Kolovos, D., Paige, R., and dos Santos, O. (2013) Engineering model transformations with transML. Software and Systems Modeling, 12, 555577. 14 Design Patterns for Model Transformations

RESEARCH PROBLEM Helping the model transformation developers in the design of model transformation through the use of design patterns Requires: 1. Finding the appropriate language to define model transformation design patterns. 2. Identifying design patterns from existing transformation solutions. 3. Generating and detecting design patterns instances for a specific model transformation language. 15 Design Patterns for Model Transformations

RELATED WORK Existing model transformation design patterns. Agrawal et al.[1]: transitive closure, leaf collector, proxy generator in GReAT. Iacob et al.[2]: mapping, refinement, flattening, duality, node abstraction in QVT-R. Bezivin et al.[3]: transformation parameters, multiple matching in ATL. Levendovszky et al.[4]: helper constructs, optimized transitive closure in VMTS. Design patterns vs reusable idioms. Implementation in specific languages [1] Agrawal, A. (2005) Reusable Idioms and Patterns in Graph Transformation Languages. International Workshop on Graph-Based Tools, ENTCS, 127, pp. 181192. Elsevier. [2] Iacob, M.-E., Steen, M. W. A., and Heerink, L. (2008) Reusable Model Transformation Patterns. EDOC Workshops, September, pp. 110. IEEE Computer Society.

[3] Bzivin, J., Jouault, F., and Palis, J. (2005) Towards model transformation design patterns. Proceedings of the First European Workshop on Model Transformations (EWMT 2005). [4] Levendovszky, T., Lengyel, L., andMszros, T. (2009) Supporting domain-specic model patterns with metamodeling. Software & Systems Modeling, 8, 501520. 16 Design Patterns for Model Transformations RELATED WORK Language for Model Transformation Design Patterns. Lano et al.[1]: used UML class diagrams and OCL constraints. Hinders the understandability of the patterns. Implementation is hard other than UML-RSDS language.

Guerra et al.[2]: proposed Rule Diagrams. Aims generating transformations. Each MTL needs its own Rule Diagram. [1] Kevin Lano and Shekoufeh Kolahdouz Rahimi (2013) Constraint-based specication of model transformations. Journal of Systems and Software, 86, 412436. [2] Guerra, E., de Lara, J., Kolovos, D., Paige, R., and dos Santos, O. (2013) Engineering model transformations with transML. Software and Systems Modeling, 12, 555577. 17 Design Patterns for Model Transformations 1. Finding the appropriate language to define model transformation design

patterns. 18 Design Patterns for Model Transformations DELTA A language to express model transformation design patterns. Features: Facilitate, reason, understand, document in a standard way [1] Independent from existing model transformation languages (MTL). Play the role of UML for model transformation design patterns. DelTa (Design pattern language for model Transformation) Offers concepts from existing MTLs.

Abstracts away MTL specific concepts. Expresses design patterns rather than model transformations. [1] Syriani, E. and Gray, J. (2012) Challenges for Addressing Quality Factors in Model Transformation. Software Testing, Verification and Validation, apr ICST12, pp. 929937. IEEE. 19 Design Patterns for Model Transformations DELTA METAMODEL 20 Design Patterns for Model Transformations

DELTA TEXTUAL SYNTAX A textual development environment for DelTa in Eclipse using Xtext 21 Design Patterns for Model Transformations DELTA GRAPHICAL SYNTAX 22 Design Patterns for Model Transformations

2. Identifying design patterns from existing transformation solutions. 23 Design Patterns for Model Transformations MT DESIGN PATTERNS Entity Relation Mapping Motivation: The most commonly used pattern for exogenous transformations and creates corresponding elements of a source language in a target language with traceability links. Applicability: Usually when a transformation from one metamodel to a different metamodel. Structure in DelTa:

Examples: Class diagram to relational database diagram. 24 Design Patterns for Model Transformations MT DESIGN PATTERNS Entity Relation Mapping Implementation: Henshin[1] [1] Arendt, T., Biermann, E., Jurack, S., Krause, C., and Taentzer, G. (2010) Henshin: Advanced Concepts and Tools for In-Place EMF Model Transformations. MODELS 2010, LNCS, 6394, pp. 121135. Springer.

25 Design Patterns for Model Transformations MT DESIGN PATTERNS Transitive Closure Motivation: Analyzing reachability related problems with an inplace transformation. Applicability: The metamodels in the domain have a structure that can be considered as a directed tree. Structure in DelTa: Examples: Helps finding the lowest common ancestor or finding all superclasses of a class in UML class diagram. 26

Design Patterns for Model Transformations MT DESIGN PATTERNS Transitive Closure Implementation: AGG[1] [1] Taentzer, G. (2004) AGG: A graph transformation environment for modeling and validation of software. AGTIVE, pp. 446453. Springer. 27 Design Patterns for Model Transformations MT DESIGN PATTERNS

Visitor Motivation: Traversing all the nodes in a graph and processing each entity individually in a breadth-first fashion. Applicability: Problems that consist of or can be mapped to any kind of graph structure. Structure in DelTa: Examples: Computing the depth level of each class in a class diagram hierarchy 28 Design Patterns for Model Transformations MT DESIGN PATTERNS Visitor Implementation:

GrGen.NET[1] [1] Gei, R. and Kroll, M. (2008) GrGen. net: A fast, expressive, and general purpose graph rewrite tool. Applications of Graph Transformations with Industrial Relevance, pp. 568569. Springer. 29 Design Patterns for Model Transformations MT DESIGN PATTERNS Fixed Point Iteration Motivation: Represents a do-until loop for model transformations. Applicability: When the problem can be solved iteratively until a fixed point is reached. Structure in DelTa:

Examples: Finding lowest common ancestor, calculating equivalent resistance in an electrical circuit. 30 Design Patterns for Model Transformations MT DESIGN PATTERNS Fixed Point Iteration Implementation: MoTif 31 Design Patterns for Model Transformations

MT DESIGN PATTERNS Execution by Translation Motivation: To execute a domain-specific language (DSL), often another well-defined semantics language is referred. This both saves time because the other language has already an execution engine. Applicability: When executing a DSL and have another language to rely on. Structure in DelTa: 32 Design Patterns for Model Transformations MT DESIGN PATTERNS Execution by Translation

Examples: Executing the Finite State Automata by translating to Petrinets [1] Implementation: MoTif [1] Khne, T., Mezei, G., Syriani, E., Vangheluwe, H., and Wimmer, M. (2010) Explicit Transformation Modeling. Models in Software Engineering, Lecture Notes in Computer Science, 6002, pp. 240255. Springer Berlin Heidelberg. 33 Design Patterns for Model Transformations 3. Generating and detecting design patterns instances for a specific model transformation language.

34 Design Patterns for Model Transformations PLANNED WORK Uses of DelTa The main question is how to auto-generate transformations using DelTa. MTLs are really diverse so DelTa is very abstract. I will try to use Rule Diagrams. Completion: 5% 35 Design Patterns for Model Transformations

PLANNED WORK Detection of DelTa Design Patterns Automatic detection of DelTa design patterns in existing model transformation solutions. Inputs: The model transformation and list of DelTa Design Patterns. Output: List of DelTa Design Patterns found in the input model. DelTa is a DSL. Therefore, detection will be a model transformation itself. Completion: 30% 36 Design Patterns for Model Transformations

PLANNED WORK Implementation of MoTif, DelTa and T-Core[1] in AToMPM Completion: 60% [1] Syriani, E., Vangheluwe, H., and LaShomb, B. (2013) T-Core: a framework for custom-built model transformation engines. Software & Systems Modeling, 13, 129. 37 Design Patterns for Model Transformations PLANNED WORK Identification of New Design Patterns Systematic literature review of model transformation intents. All the papers that have model transformation case studies, examples,

demonstrations between 2003-2013. Help me see how problems are solved in different languages and settings. Identification can be done in two methods: Solving different problems and coming up with a common solution. Analyzing existing examples. With more design patterns, classification is next. Completion: 50% 38 Design Patterns for Model Transformations PLANNED WORK Empirical Evaluation of DelTa

An empirical experiment for real transformation developers. Research question focus on the usability of DelTa in developers point of view. A pilot study in our university. The main language will be MoTif. Main study is aiming Transformation Tool Contest 2015. Where real developers implement model transformations in many different MTLs. A case study will be provided for the contest. Outcomes are: Possible revisions to DelTa with respect to the feedbacks from the study. The experiences of DelTa with different languages. Completion: 5% 39

Design Patterns for Model Transformations TIMELINE Fall 2014: Identification of new design patterns with Intents Study (3 terms). Designing DelTa modeling environment in AToMPM. Preparing empirical evaluation experiment and case study of DelTa. Conducting the pilot empirical evaluation on subjects. Spring 2015: Uses of DelTa with Rule Diagrams. Paper with newly identified design patterns and revisions to DelTa as a result of initial test experiment. Preparing the paper for SoSym with DelTa in its final form and results of empirical evaluation. Detecting DelTa design patterns in MoTif transformations.

Summer 2015: Conduct empirical evaluation in TTC Writing dissertation. Fall 2015: Dissertation defense & graduation 40 Design Patterns for Model Transformations CONCLUSION Model transformation development is a hard task. And will be better with help of design patterns.

To help model transformation developers in the design phase, I have: Created DelTa: A language for model transformation design patterns Populated an initial collection of model transformation design patterns Been working on how to automatically generate transformation by DelTa specifications. I have also implemented: MoTif and T-Core DSLs in AToMPM and execution engines in Python to help to detect DelTa design patterns 41 Design Patterns for Model Transformations

LIST OF PUBLICATIONS Published 1. Eugene Syriani and Huseyin Ergin. Operational Semantics of UML Activity Diagram: An Application in Project Management. Requirement Engineering Conference 2012 Workshops, IEEE, Chicago, IL (September 2012) 2. Huseyin Ergin and Eugene Syriani. Identification and Application of a Model Transformation Design Pattern. ACM Southeast Conference 2013, Savannah, GA (April 2013) 3. Huseyin Ergin.Model Transformation Design Patterns.MODELS Conference 2013 Doctoral Symposium, Miami, FL (October 2013) 4. Eugene Syriani, Hans Vangheluwe, Raphael Mannadiar, Conner Hansen, Simon van Mierlo, and Huseyin Ergin. AToMPM: AWeb-basedModeling Environment.MODELS Conference 2013 Demonstrations, Miami, FL (October 2013) Technical Report 5. Huseyin Ergin and Eugene Syriani. Implementations of Model Transformation Design Patterns Expressed in DelTa. Department of Computer Science, University of Alabama, SERG-2014-01 (February 2014) Accepted & To Be Presented 6. Huseyin Ergin and Eugene Syriani. Towards A Language To Express Design Patterns for Graph- Based Model Transformation. International Conference on Model Transformation 2014, York, UK (July 2014)

7. Huseyin Ergin and Eugene Syriani. AToMPM Solution for the IMDB Case Study. Transformation Tool Contest 2014, York, UK (July 2014) A.3 In Preparation & Planning 8. Huseyin Ergin and Eugene Syriani. Reuse of Model Transformation Design Patterns. Models Workshops 9. Huseyin Ergin and Eugene Syriani. DelTa: A Language for Model Transformation Design Patterns. Journal of Software and Systems Modeling (2015) 10. Huseyin Ergin and Eugene Syriani. Model Transformation Design Patterns in Action: Experiences with DelTa. Automated Software Engineering (2015) 11. Huseyin Ergin and Eugene Syriani. The Experiences on How To Generate Transformations Using DelTa. International Conference on Model Transformation (2015) 12. Eugene Syriani, Jeffrey Carver, Huseyin Ergin, and Ahmet AlZubidy. Model Transformation Intents: A Systematic Literature Review. Empirical Software Engineering Conference (2015) 13. Huseyin Ergin and Eugene Syriani. DelTa Case Study. Transformation Tool Contest (2015) 42