An Approach to Maintainable Model Transformations with an Internal DSL

An Approach to Maintainable Model Transformations with an Internal DSL

An approach to maintainable model transformations with an internal DSL Master thesis of Georg Hinkel At the Department of Informatics Institute for Program Structures and Data Organization (IPD) Reviewer: Prof. Dr. Ralf Reussner Second reviewer: Prof. Dr. Walther Tichy Advisor: Dr. Lucia Happe Second advisor: Dr. Thomas Goldschmidt Duration:: 1st May 2013 – 31th October 2013 KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association www.kit.edu I declare that I have developed and written the enclosed thesis completely by myself, and have not used sources or means without declaration in the text. PLACE, DATE ......................................... (Georg Hinkel) iii Abstract In recent years, model-driven software development (MDSD) has gained popularity among both industry and academia. MDSD aims to generate traditional software artifacts from models. This generation process is realized in multiple steps. Thus, before being transformed to software artifacts, models are transformed into models of other metamodels. Such model transformation is supported by dedicated model transformation languages. In many cases, these are entirely new languages (external domain-specific languages, DSLs) for a more clear and concise represen- tation of abstractions. On the other hand, the tool support is rather poor and the transformation developers hardly know the transformation language. A possible solution for this problem is to extend the programming lan- guage typically used by developers (mostly Java or C#) with the re- quired abstractions. This can be achieved with an internal DSL. Thus, concepts of the host language can easily be reused while still creating the necessary abstractions to ease development of model transformations. Furthermore, the tool support for the host language can be reused for the DSL. In this master thesis, NMF Transformations is presented, a frame- work and internal DSL for C#. It equips developers with the ability to specify model transformations in languages like C# without having to give up abstractions known from model transformation standards. Transformation developers get the full tool support provided for C#. The applicability of NMF Transformations as well as the impact of NMF Transformations to quality attributes of model transforma- tions is evaluated in three case studies. Two of them come from the Transformation Tool Contests 2013 (TTC). With these case studies, NMF Transformations is compared with other approaches to model transformation. A further case study comes from ABB Corporate Re- search to demonstrate the advantages of NMF Transformations in an industrial scenario where aspects like testability gain special impor- tance. iii v Zusammenfassung In den letzten Jahren hat sich das Konzept der Modellgetriebenen Softwareentwicklung (MDSD) zunehmend verbreitet. MDSD zielt da- rauf ab, Traditionelle Softwareartefakte aus Modellen zu generieren. Diese Generierung geschieht uber¨ mehrere Stufen, sodass Modelle erst mit Hilfe von Modelltransformationen in andere Modelle transformiert werden. Solche Modelltransformationen werden von dedizierten Mod- elltransformationssprachen unterstutzt,¨ die in vielen F¨allen komplett eigene Sprachen (externe dom¨anenspezifische Sprachen, DSLs) sind. Dies tr¨agt dazu bei, dass Abstraktionen kompakter und klarer repr¨asen- tiert werden k¨onnen. Auf der anderen Seite ist die Werkzeugunter- stutzung¨ meist unzureichend und die Transformationssprache kennen die Sprache nicht. Eine m¨ogliche L¨osung fur¨ dieses Problem ist, mit Hilfe einer internen DSL die fur¨ Modelltransformationen n¨otigen Abstraktionen direkt in die Sprache einzubinden, mit der Entwickler typischerweise arbeiten (in den meisten F¨allen Java oder C#). Dadurch k¨onnen bestehende Konzepte aus der Hostsprache wiederverwendet werden und gleichzeitig Abstrak- tionen geschaffen werden, die die Entwicklung von Modelltransformatio- nen erleichtern. Auf der anderen Seite kann die Werkzeugunterstutzung¨ der Hostsprache teilweise ubernommen¨ werden. In dieser Masterarbeit wird NMF Transformations vorgestellt, das eine interne DSL fur¨ C#, zur Verfugung¨ stellt. Transformationsentwick- lern wird damit die M¨oglichkeit gegeben, Modelltransformationen in C# zu spezifizieren, ohne auf die aus Modelltransformationsstandards bekan- nten Abstraktionen verzichten zu mussen.¨ Transformationsentwickler werden dabei wie aus C# gewohnt von Visual Studio unterstutzt.¨ Die Anwendbarkeit und die Auswirkungen der Sprachgestaltung von NMF Transformations auf Qualit¨atsattribute fur¨ Modelltransforma- tionen wird evaluiert durch drei Fallstudien. Zwei Fallstudien wurden bei dem Transformation Tool Contests 2013 (TTC) eingereicht, um NMF Transformations mit anderen Ans¨atzen vergleichen zu k¨onnen. Eine weitere Fallstudie von ABB Corporate Research wurde bearbeitet, um den Nutzen von NMF Transformations in einem industriellen Um- feld zu demonstrieren, wo Kriterien wie Testbarkeit besondere Bedeu- tung haben. v Contents 1. Introduction 1 1.1. Motivation . .1 1.2. Structure of this Master Thesis . .3 1.3. Contribution . .5 1.4. How to read this thesis . .6 2. Related Work 9 2.1. MTLs with external DSL . .9 2.2. Model Transformation as Graph Transformation . 10 2.3. MTLs with internal DSL . 10 2.4. Comparison of MTLs . 11 2.5. Maintainability of model transformations . 11 3. Foundations 15 3.1. Model-driven software development . 15 3.2. Query-View-Transformation (QVT) . 17 3.2.1. QVT Operational . 17 3.2.2. QVT Relational . 20 3.3. C# language features . 22 3.3.1. Local type inference . 22 3.3.2. Initialization lists and anonymous types . 23 3.3.3. Extension methods . 23 3.3.4. Lambda-expressions (Closures) . 23 3.3.5. Monads . 24 3.4. Quality Attributes of Model Transformations . 26 3.4.1. Understandability . 26 3.4.2. Modifiability . 27 3.4.3. Reusability . 27 3.4.4. Modularity . 27 3.4.5. Completeness . 27 3.4.6. Consistency . 28 3.4.7. Conciseness . 28 4. Example Transformations 29 4.1. Finite State Machines to Petri Nets . 29 4.2. People to Family Relations . 31 5. Supporting model transformation with dedicated languages 33 5.1. The domain of model transformation . 33 5.2. MTLs as External DSLs . 35 5.3. MTLs as Internal DSLs . 36 5.4. Conclusions . 38 vii viii Contents 6. Model Transformation Problems 39 6.1. Correspondence & tracing . 39 6.1.1. Problem description . 39 6.1.2. Solutions in general purpose code . 40 6.1.3. Solutions in QVT-O and QVT-R . 40 6.2. Cyclic object models . 40 6.2.1. Problem description . 40 6.2.2. Solutions in general purpose code . 40 6.2.3. Solutions in QVT-O and QVT-R . 40 6.3. Inheritance . 41 6.3.1. Problem description . 41 6.3.2. Solutions in general purpose code . 41 6.3.3. Solutions in QVT-O and QVT-R . 42 6.4. Patterns . 42 6.4.1. Problem description . 42 6.4.2. Solutions in general purpose code . 42 6.4.3. Solutions in QVT-O and QVT-R . 42 6.5. Optimization Tasks . 42 6.5.1. Problem description . 42 6.5.2. Solutions in general purpose code . 43 6.5.3. Solutions in QVT-O and QVT-R . 43 6.6. Higher-Order Transformations . 44 6.6.1. Problem description . 44 6.6.2. Solutions in general purpose code . 44 6.6.3. Solutions in QVT-O and QVT-R . 45 6.7. Transformation Composition . 45 6.7.1. Problem description . 45 6.7.2. Solutions in general purpose code . 45 6.7.3. Solutions in QVT-O and QVT-R . 46 6.8. Testing . 46 6.8.1. Problem description . 46 6.8.2. Solutions in general purpose code . 46 6.8.3. Solutions in QVT-O and QVT-R . 47 6.9. Conclusions . 47 7. NMF Transformations 49 7.1. Abstract syntax . 50 7.2. Architecture of NMF Transformations Core ............... 53 7.3. Stages of the transformation . 55 7.3.1. Initialization . 56 7.3.2. Create Patterns . 56 7.3.3. Execute dependencies . 56 7.3.4. Create delayed outputs . 56 7.3.5. Transform . 57 7.3.6. Finish Patterns . 57 7.4. NMF Transformations Language (NTL) . 57 7.4.1. Specifying Transformations . 57 7.4.2. Specifying Transformation Rules . 59 7.4.3. Dependencies between transformation rules . 60 7.4.4. Tracing . 64 7.4.5. Transformation rule instantiation . 67 7.4.6. Relational Extensions . 70 viii Contents ix 7.4.7. Composing Transformations . 73 7.4.8. Testing . 76 7.4.9. Extensibility . 78 7.5. Drawbacks & Future Work . 80 7.5.1. Trace serialization . 80 7.5.2. Change propagation . 81 7.5.3. Bidirectionality . 82 7.5.4. Model synchronization . 82 7.5.5. Graphical syntax . 83 7.5.6. Test case generation . 83 7.5.7. Parallelism . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    232 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us