Model Transformation Languages Under a Magnifying Glass:A Controlled Experiment with Xtend, ATL, And
Total Page:16
File Type:pdf, Size:1020Kb
CORE Metadata, citation and similar papers at core.ac.uk Provided by The IT University of Copenhagen's Repository Model Transformation Languages under a Magnifying Glass: A Controlled Experiment with Xtend, ATL, and QVT Regina Hebig Christoph Seidl Thorsten Berger Chalmers | University of Gothenburg Technische Universität Braunschweig Chalmers | University of Gothenburg Sweden Germany Sweden John Kook Pedersen Andrzej Wąsowski IT University of Copenhagen IT University of Copenhagen Denmark Denmark ABSTRACT NamedElement name : EString In Model-Driven Software Development, models are automatically processed to support the creation, build, and execution of systems. A large variety of dedicated model-transformation languages exists, Project Package Class StructuralElement modifiers : Modifier promising to efficiently realize the automated processing of models. [0..*] packages To investigate the actual benefit of using such specialized languages, [0..*] subpackages [0..*] elements Modifier [0..*] classes we performed a large-scale controlled experiment in which over 78 PUBLIC STATIC subjects solve 231 individual tasks using three languages. The exper- FINAL Attribute Method iment sheds light on commonalities and differences between model PRIVATE transformation languages (ATL, QVT-O) and on benefits of using them in common development tasks (comprehension, change, and Figure 1: Syntax model for source code creation) against a modern general-purpose language (Xtend). Our results show no statistically significant benefit of using a dedicated 1 INTRODUCTION transformation language over a modern general-purpose language. In Model-Driven Software Development (MDSD) [9, 35, 38] models However, we were able to identify several aspects of transformation are automatically processed to support creation, build and execution programming where domain-specific transformation languages do of systems. Transformations are, among others, used to compute appear to help, including copying objects, context identification, views on models, to validate models [25], to refactor models [43], to and conditioning the computation on types. interpret or otherwise execute models [28, 30], to implement model debuggers [24], to transform models to lower-level models [31], and CCS CONCEPTS to implement model-management operations such as versioning [2]. • Software and its engineering → Context specific languages; To support the multitude of processing tasks, many specialized General programming languages; model-transformation languages have been developed as a result of a substantial research effort [12, 26]. Outside MDSD, the trans- KEYWORDS formation languages are also gaining importance; in the program- ming-language [10, 11, 19, 36] and the data-processing community Model Transformation Languages, Experiment, Xtend, ATL, QVT (see for example http://www.cloveretl.com). Transformation languages come with an implicit promise to be ACM Reference Format: Regina Hebig, Christoph Seidl, Thorsten Berger, John Kook Pedersen, and An- easier to use and more efficient for specifying transformations than drzej Wąsowski. 2018. Model Transformation Languages under a Magni- general-purpose programming languages (GPLs). However, does fying Glass: A Controlled Experiment with Xtend, ATL, and QVT. In Pro- this promise hold? We heard this question multiple times in inter- ceedings of the 26th ACM Joint European Software Engineering Conference actions with industrial software teams. Unfortunately, little system- and Symposium on the Foundations of Software Engineering (ESEC/FSE ’18), atic knowledge exists to respond, besides experience reports from November 4–9, 2018, Lake Buena Vista, FL, USA. ACM, New York, NY, USA, case studies [16]. This hampers choosing between a GPL, which 11 pages. https://doi.org/10.1145/3236024.3236046 can solve many tasks, and a specialized language that promises efficiency gains, but requires highly specialized programmers. As the automation of software-engineering tasks is a growing Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed trend, and as software projects mix increasingly many languages for profit or commercial advantage and that copies bear this notice and the full citation and formats, we can only expect that the time spent by developers on the first page. Copyrights for components of this work owned by others than the on creating transformation programs will be growing, and so will author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission the amount and importance of transformations. The transformation and/or a fee. Request permissions from [email protected]. languages promise to positively contribute to this effort. It is, thus, ESEC/FSE ’18, November 4–9, 2018, Lake Buena Vista, FL, USA key that we develop understanding on how programmers use trans- © 2018 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-5573-5/18/11...$15.00 formation languages, what problems they face, and what aspects https://doi.org/10.1145/3236024.3236046 of these languages emerge as particularly useful or problematic. ESEC/FSE ’18, November 4–9, 2018, Lake Buena Vista, FL, USA R. Hebig, C.Seidl, T. Berger, J. Kook Pedersen, A. Wąsowski We settled to answer some of these questions in a controlled packages subpackages :Project :Package :Package experiment with three established model transformation languages, name = "CustomerManagement" name = "p1" name = "p2" employed in program-comprehension, program-modification, and classes classes program-creation tasks. We recruited 78 graduate students from :Class :Class Chalmers | University of Gothenburg and Technische Universität name = "Customer" name = "Order" elements elements Braunschweig, and observed how they cope with the languages: :Attribute :Attribute name = "age" name = "date" ATL [17], QVT-O [23], and Xtend [8]—the first two dedicated and modifiers = {PUBLIC, STATIC} modifiers = {PUBLIC} elements elements established model transformation languages, the third a high-level :Attribute :Method name = "name" name = "confirm" GPL. Analyzing solutions of 231 tasks, we found that: modifiers = {PUBLIC} modifiers = {PUBLIC} elements • Handling multi-valued features (collections), recursion, and :Attribute name = "membershipNo" designing logical branching conditions are among the most modifiers = {PUBLIC, FINAL} elements difficult skills to master for the developers. :Method • Even well qualified subjects struggle to evolve transforma- name = "getAge" modifiers = {PUBLIC} tions optimally, producing changes of widely diverse sizes. • Implicit object creation, implicit structure copying, and sup- Figure 2: An instance of the model shown in Fig.1 port for type-driven computation and explicit computation We focus on three languages used for M2M: The Atlas Trans- context do appear to reduce the amount of errors. formation Language (ATL) is a mostly declarative domain-specific • There is no sufficient (statistically significant) evidence of M2M language.2 Listing 3a shows an example of ATL: The keyword a general advantage of specialized model transformation rule defines a named transformation for model elements ofthe languages (ATL, QVT-O) over a modern GPL (Xtend). source type (from) to those of the specified target type (to). The This work aims at the interest of researchers and practitioners first specified rule implicitly designates the entry point for thetrans- working with transformation languages, and building new tools formation specification. The invocation order of rules is implicit: in the modeling, DSL, and programming-languages communities. The transformation engine processes source instances according to It can also be of interest to software architects considering using the containment hierarchy specified in the respective model and GPLs or dedicated languages for a transformation task. automatically involves a matching rule for the encountered element of the source instance. The rules marked lazy may be invoked man- 2 BACKGROUND ually, in which case the call has to be qualified with the implicit We are concerned with model-to-model (M2M) transformations, so thisModule variable. The result of a rule is created by an implicit programs transforming instances of a source model to instances of instantiation of the target type. Then the values are assigned to the a target model (structured data to structured data)—in contrast to fields (object attributes and links) of the instantiated element. In model-to-text (M2T) transformations, which are typically imple- ATL, <- serves as the assignment operator. ATL provides various mented in template languages and used for code generation. To operations on collections: For instance, exists checks if at least one represent the abstract syntax of model instances, we use instance collection member satisfies a predicate, select creates a derived specifications (object diagrams), where objects represent model set with only those members that satisfy a given condition and elements, and the links between them represent the relationships collect (called map in many other languages) applies a mapping between model elements. All three languages considered in this function to every element of a collection, creating a new collection. experiment are integrated with the Eclipse Modeling Framework Query-View-Transformation