Model Transformation Languages with Modular Information Hiding the Karlsruhe Series on Software Design and Quality Volume 17
Total Page:16
File Type:pdf, Size:1020Kb
The Karlsruhe Series on Software Design and Quality 17 Model Transformation Languages with Modular Information Hiding Andreas Rentschler Model Transformation Languages Model Transformation with Modular Information Hiding transformation module M export I1 import I2 { mapping A::m1():B { } Andreas Rentschler 17 Andreas Rentschler Model Transformation Languages with Modular Information Hiding The Karlsruhe Series on Software Design and Quality Volume 17 Chair Software Design and Quality Faculty of Computer Science Karlsruhe Institute of Technology and Software Engineering Division Research Center for Information Technology (FZI), Karlsruhe Editor: Prof. Dr. Ralf Reussner Model Transformation Languages with Modular Information Hiding von Andreas Rentschler Dissertation, Karlsruher Institut für Technologie (KIT) Fakultät für Informatik Tag der mündlichen Prüfung: 14. Januar 2015 Referenten: Prof. Dr. Ralf Reussner Prof. Dr. Bernhard Beckert Impressum Karlsruher Institut für Technologie (KIT) KIT Scientific Publishing Straße am Forum 2 D-76131 Karlsruhe KIT Scientific Publishing is a registered trademark of Karlsruhe Institute of Technology. Reprint using the book cover is not allowed. www.ksp.kit.edu This document – excluding the cover – is licensed under the Creative Commons Attribution-Share Alike 3.0 DE License (CC BY-SA 3.0 DE): http://creativecommons.org/licenses/by-sa/3.0/de/ The cover page is licensed under the Creative Commons Attribution-No Derivatives 3.0 DE License (CC BY-ND 3.0 DE): http://creativecommons.org/licenses/by-nd/3.0/de/ Print on Demand 2015 ISSN 1867-0067 ISBN 978-3-7315-0346-0 DOI: 10.5445/KSP/1000045910 Model Transformation Languages with Modular Information Hiding zur Erlangung des akademischen Grades eines Doktors der Ingenieurwissenschaften der Fakultät für Informatik des Karlsruher Instituts für Technologie genehmigte Dissertation von Andreas Rentschler aus Eberbach (Baden) Tag der mündlichen Prüfung: 14. Januar 2015 Erster Gutachter: Prof. Dr. Ralf Reussner Zweiter Gutachter: Prof. Dr. Bernhard Beckert Abstract With a ratio of an estimated 60%, maintenance costs constitute a substiantial share of the lifecycle costs of a typical software project. It is a major ob- jective of software engineers to explore techniques that help to enhance maintainability and understandability of software artifacts. One established concept in this field is modular programming. By providing concepts to divide functionality into independent modules, modular programming helps to manage even complex programs. David L. Parnas has expanded on this idea by introducing the additional concept of module interfaces. Accord- ing to Parnas, any outbound dependencies of a module must be explicitly declared in the module’s interface description to foster the encapsulation of design decisions (information hiding). Modularity is broadly used by modern general-purpose languages to tackle the complexity of larger programs. No need for such a high-level concept arises for most domain-specific languages, i.e., lean languages designed for compact problem descriptions. One notable exception to this rule of thumb are model transformation languages. Model transformations, together with models, form the principal artifacts in model-driven software development, a methodology of software engineering that aims to automatically generate large parts of a software from abstract models. In such a process, transforma- tions play a pivotal role, as they assign semantics to models by means of other models and languages with already well-defined semantics, usually residing at a lower level of abstraction. Industrial practitioners report that, despite their domain-specificity, transformation programs on larger models quickly get sufficiently large and complex and at the same time less maintainable. i A multitude of specific transformation languages exist, and most of them establish some sort of modularity, but almost all of them solely have reuse in mind while they neglect maintenance issues. An interface concept to attain information hiding modularity as propagated by Parnas is supported by none of them. This thesis presents three contributions that render maintenance of model transformations more efficient. The first and major scientific contribution of this thesis is an information hiding modularity concept tailored to model transformations. One novelty when it comes to model transformations is that metamodels are software artifacts that are specified independently from the transformation. Thus, interfaces must not only control visibility of methods, but also control accessibility to incoming and outgoing data types. Access control can be explicitly declared on a fine-grained level, i.e., packages and classes inside a metamodel. For obtaining maximal usability, on top of our proposed syntactical extension, a type inference system is defined that statically checks at design-time if interface contracts are met or if they are not. Our module concept has been initially defined for the imperative transformation language QVT-Operational (QVT-O) due to its clarity. In the scope of this thesis, it is further shown that the concept is applicable to declarative transformation languages as well. In this context, we study the semantics of the declarative transformation language QVT- Relations (QVT-R). Legacy transformations are often monolithic or a suitable modular design cannot be determined. To improve maintenance effort in such cases, we de- velop a concept for visualization of dependence information according to the methodology of visual analytics, the second contribution of this thesis. The concept is implemented as a maintenance tool that statically analyzes dependencies occurring among mapping methods and model elements. In- formation is shown in an interactive graph-based view that offers cross-view navigation and task-dependent filtering. ii In addition, a software clustering approach is adapted to the requirements of the transformation domain. It forms the third contribution of this thesis. In contrast to previously known approaches, high cohesion and low coupling is not only based on control dependencies, it can also incorporate dependencies to the classes of metamodels and their package structure. The approach is particularly suitable to find decompositions for legacy transformations. We evaluated each of the three contributions in a case study based on larger transformations from the Palladio research project. For this purpose, the module concept had been integrated into two imperative transformation languages, Xtend and QVT-O. The first study focuses on an Xtend transformation that maps architec- tural descriptions in the Palladio component model to simulation code. It is shown that locating the concerns in the modularized variant requires signifi- cantly less effort than in the previous unmodularized variant. In the study, two realistic maintenance scenarios had been examined, a bug fix and a functional enhancement. The second case study validates the visualization approach in an empirical experiment. Participants had to carry out realistic maintenance tasks on a QVT-O transformation for mapping the Palladio com- ponent model to a queueing Petri net model. Results show that participants using the approach spotted locations of concerns with significantly higher efficiency. The third case study aims to evaluate the automatic clustering approach. Two previously modularized transformations are automatically re-modularized, one QVT-O transformation that translates a set of advanced modeling concepts of the Palladio model to basic concepts, and an Xtend transformation that maps the Palladio model to simulation code. We are able to confirm a significantly higher similarity between the automatically and the manually clustered variant, when taking not only control but also model struc- tures and dependencies into account of the automatic clustering process. This dissertation points out that also domain-specific languages must provide appropriate structuring concepts to ensure readability and main- tainability of larger and more complex programs. The particular notion iii of an interface highly depends on the domain and the requested level of granularity; In the case of model transformations, for example, we regard mapping methods in combination with distinct model elements as equivalent parts of an interface, thereby gaining extended expressiveness that results in significantly better maintainable software. iv Kurzfassung Betrachtet man die Gesamtkosten eines typischen Softwareprojekts über seinen gesamten Lebenszyklus, so tragen die Kosten ihrer Wartung mit geschätzten 60% zu einem wesentlichen Teil zu den Gesamtkosten bei. Soft- waretechniker sind deswegen von je her an Techniken interessiert, die die Wartbarkeit und Lesbarkeit der Softwareartefakte steigern. Ein bewährtes Entwurfskonzept ist das modulare Programmieren; es sieht die Auftren- nung von Funktionalität in unabhängige Module vor, und macht damit auch komplexere Programme beherrschbar. David L. Parnas hat diese Idee um einen Schnittstellenbegriff erweitert, bei dem die Abhängigkeiten eines Moduls nach außen explizit in seiner Schnittstelle zu deklarieren sind, um die Kapselung von Entwurfsentscheidungen – das sogenannte Information Hiding – zu ermöglichen. Derartig ausgereifte Modulkonzepte sind jedoch bisher hauptsächlich nur in Allzwecksprachen vorzufinden, während domänenspezifischere Sprachen in der Regel nur für kleinere Programme konzipiert sind, sodass Wartungs- probleme hier eher selten auftreten. Eine Ausnahme