Model Transformation Design Patterns Huseyin Ergin Advisor: Eugene Syriani Software Modeling Lab Software Engineering Group Department of Computer Science College of Engineering University of Alabama Model Transformation Design Patterns OUTLINE Introduction Problem

Related Work Proposed Solution Design pattern language Evaluation framework Current Status & Plan Conclusion 2 Model Transformation Design Patterns INTRODUCTION MDE is software development approach that uses abstraction between problem and software implementation Models Transformations

MDE solutions often involve a series of model transformations. Model transformation: automatic manipulation of input models to produce output models, that conforms to a specification and has a specific intent [1]. Intent is the description of the goal behind the model transformation and the reason for using it. Some intents: Model Editing, Query, Translation, Optimization etc. [1] Amrani, M.; Dingel, J.; Lambers, L.; Lucio, L.; Salay, R.; Selim, G.; Syriani, E. & Wimmer, M. Towards a Model Transformation Intent Catalog MoDELS workshop on Analysis of model Transformation, 2012 3 Model Transformation Design Patterns

PROBLEM Model transformations conform to specific model transformation languages. Main components: Rules and scheduling Developing a model transformation requires designing rules and identifying scheduling between them. Problematic: Optimize the design of model transformations in a reusable way. Not only efficiency, but also readability, understandability, etc. In object-oriented community, design patterns are typically used. I think design pattern concept can fit to model transformation too. 4

Model Transformation Design Patterns RELATED WORK Agrawal et al. [2] has presented three model transformation design patterns Leaf collector, Transitive closure, Proxy generator idiom Iacob et al. [3] has presented five model transformation design patterns Mapping pattern, Refinement pattern, Node abstraction pattern, Duality pattern, Flattening pattern Common properties of these studies: These patterns are not analyzed in terms of quality No standard language to display the structure of the pattern.

Patterns for designing models and metamodels. [2] A. Agrawal, Reusable Idioms and Patterns in Graph Transformation Languages, in International Workshop on Graph-Based Tools, ser. ENTCS, vol. 127. Rome: Elsevier, March 2005, pp. 181192 [3] M.-E. Iacob, M. W. A. Steen, and L. Heerink, Reusable Model Transformation Patterns, in Proceedings of the Enterprise Distributed Object Computing Conference Workshops. Munich: IEEE Computer Society, Setpember 2008, pp. 110. 5 Model Transformation Design Patterns PRELIMINARY STUDY We have identified a model transformation design pattern and applied it to three different problems to show its usability[4]. The Fixed Point Iteration Design Pattern is applicable when iterating over small local changes to an intermediate structure on the input model helps until a solution to the problem is reached.

We have applied it: To find the lowest common ancestor To compute the equivalent resistance To find the shortest path by using Dijkstras shortest path algorithm We have implemented it using the MoTif[5] transformation language. [4] Hseyin Ergin and Eugene Syriani. Identification and Application of a Model Transformation Design Pattern. ACM Southeast Conference, ACMSE'13. ACM, Savannah GA, U.S.A., April (2013) [5] Eugene Syriani and Hans Vangheluwe. A Modular Timed Model Transformation Language. Journal on Software and Systems Modeling, 12, no. 2, pp. 387-414 jun (2011). 6 Model Transformation Design Patterns

RUNNING EXAMPLE Lowest Common Ancestor Problem [6]: In a tree structure find the lowest common ancestor of two given nodes. Solution using a nave approach A metamodel for such a tree: [6] A. V. Aho, J. E. Hopcroft, and J. D. Ullman, On finding lowest common ancestors in trees, in Proceedings of the fifth annual ACM symposium on Theory of computing, ser. STOC 73. New York, NY, USA: ACM, 1973, pp. 253265. 7 Model Transformation Design Patterns ILLUSTRATION 8

Model Transformation Design Patterns RUNNING EXAMPLE IMPROVED SOLUTION Now this solution uses locality Focus in the area of input nodes, and check for a solution in every step Rules Scheduling 9 Model Transformation Design Patterns ILLUSTRATION

10 Model Transformation Design Patterns DESIGN PATTERN LANGUAGE Transformation-language independent Notation MTL independent Abstraction of individual MTL from structural point of view 11 Model Transformation Design Patterns DESIGN PATTERN INSTANCE Different textual syntaxes of the design pattern language.

Transformation FixedPointIteration Meta-model any Block initiate Output success to check Rule check Output success to END_SUCCESS Output fail to advance Block advance Output success to check Output fail to END_FAIL We are still investing for the most appropriate design pattern language and its concrete syntax 12 Model Transformation Design Patterns

DISCOVERY OF DESIGN PATTERNS TTC: Transformation Tool Contest Many solutions in different MTLs for same problem ATL Transformation Zoo Same language, many problems Transformations case studies found in the literature Conferences (MODELS, ICMT, ECMFA, ICGT, FASE ) and Journals (SoSym ) Two methods for now: Given a problem, evaluate existing solutions to deduce a design pattern Focus on single problem at a time and solve it using different approaches

13 Model Transformation Design Patterns EVALUATION A design pattern should optimize at least one quality criteria I have analyzed the design pattern we introduced in terms of three metrics (Efficiency point of view) Following table is a starting point of how a design pattern can be evaluated. 14 Model Transformation Design Patterns EVALUATION FRAMEWORK

I created the following evaluation framework inspired from [7]. [7] P. Mohagheghi and V. Dehlen, Developing a Quality Framework for Model-Driven Engineering, in Models in Software Engineering, ser. Lecture Notes in Computer Science, H. Giese, Ed. Springer Berlin Heidelberg, 2008, vol. 5002, pp. 275286 15 Model Transformation Design Patterns METRICS FOR MODEL TRANSFORMATION LANGUAGES Metrics are always necessary for assessing the quality. Divided into three categories[8]. Language independent metrics Related with core model transformation components

Example: Size of rules, number of rule applications etc. Transformation independent metrics Focus on specific model transformation languages Example for QVT: number of enforced domains, number of when predicates etc. Transformation dependent metrics Specific to particular model transformation problems Example: In Dijkstra, some restrictions on the solution. Measuring these metrics can be done statically (as we did for LCA) or dynamic or empirically [8] M. Amrani, L. Lucio, G. Selim, B. Combemale, J. Dingel, H. Vangheluwe, Y. Le Traon, and J. Cordy, A Tridimensional Approach for Studying the Formal Verification of Model Transformations, in Software Testing, Verification and Validation (ICST), 2012 IEEE Fifth International Conference on, april 2012, pp. 921 928.

16 Model Transformation Design Patterns QUALITY CRITERIA FOR MODEL TRANSFORMATION These are the standard quality criteria from software engineering (e.g. ISO 9006) Adapting them to model transformation. Correctness: Output of the transformation must conform to metamodel Re-usability: Unit rules or other reusable structures in a language

Efficiency: Underlying graph transformation, pattern matching make this criterion a must-to-satisfy Some others: reliability, maintainability, interoperability etc. 17 Model Transformation Design Patterns USER STUDIES IN EVALUATION Predefined experiments with different scenarios Application of these experiments on targeted users In our case, they will be model transformation developers Users are requested to solve problems with no prior design pattern information

Then design patterns are introduced. The results will be analyzed. It can be supported with questionnaires and surveys at the end\beginning. 18 Model Transformation Design Patterns CURRENT STATUS & PLAN We are adding new features to our modeling and transformation tool, AToMPM[9]. Improvement of the design pattern language (Fall 2013) The current structure shows similarities to our model transformation language. Support for other popular model transformation languages

Starting from ATL and QVT Each language has its own characteristics So the DP language should be as abstract as possible [9] E. Syriani, H. Vangheluwe, R. Mannadiar, C. Hansen, S. Van Mierlo and H. Ergin. AToMPM: A Web-based Modeling Environment. MODELS'13 Demonstrations. CEUR, Miami, October (2013) 19 Model Transformation Design Patterns CURRENT STATUS & PLAN CONTD Identification of New Design Patterns (Fall 2013 Spring 2014) So far, we have identified one model transformation design pattern. Model transformation problems should be investigated carefully to see

similarities and lacks. With the methods I mention previously Categorization with respect to intents will help to reduce the size. Evaluation with respect to quality framework 20 Model Transformation Design Patterns CURRENT STATUS & PLAN CONTD Adapting existing design patterns (Fall 2013) Existing design patterns will be adapted to fit in new DP language Respective authors call reusable idioms or patterns They should be analyzed in terms of my quality framework.

Application & Generation (Spring 2013 Spring 2014) An IDE that design patterns can be inserted automatically Generation in a specific model transformation language to be a part of a larger model transformation solution 21 Model Transformation Design Patterns CONCLUSION Design patterns are proven approach for reusability (in objectoriented community) I believe model transformation design patterns will lead developers to increase effectiveness and decrease time and cost required to solve a model transformation problem. The DP language will be useful if I can make it to support as many transformation languages as possible.

22 Model Transformation Design Patterns FROM REVIEWERS Example of new formalism (now language). An instance is given. It is still evolving according to new design patterns and model transformation languages. What differs my work from existing works? Existing works neither analyzed their design pattern nor provided a generic representation of them. I will try to do the both in my dissertation. Description of a design pattern

Exactly same as in object-oriented community. A design pattern describes a problem which occurs over and over again and then describes the core of the solution in such a way that you can use million times[10]. [10] Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns Elements of Reusable Object-Oriented Software, 1996 23 Model Transformation Design Patterns FROM REVIEWERS Characteristic of a good/bad design pattern It totally depends on the problem. I will analyze them and identify quality properties but this is not a verdict. It is just a suggestion on the consequences of this pattern.

Formalism name is not appropriate I decided it is another DSL so I changed it to Design Pattern Language To be discussed Design patterns or reusable idioms? 24 Model Transformation Design Patterns QUESTIONS? Thanks for listening 25