Automated Coevolution of Source Code and Software Architecture Models the Karlsruhe Series on Software Design and Quality Volume 23
Total Page:16
File Type:pdf, Size:1020Kb
The Karlsruhe Series on Software Design and Quality 23 Automated Coevolution of Source Code and Software Architecture Models Michael Langhammer Automated Coevolution of Source Code Automated Coevolution of Source Models Architecture and Software Michael Langhammer Michael Langhammer Automated Coevolution of Source Code and Software Architecture Models The Karlsruhe Series on Software Design and Quality Volume 23 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 Automated Coevolution of Source Code and Software Architecture Models by Michael Langhammer Dissertation, Karlsruher Institut für Technologie KIT-Fakultät für Informatik Tag der mündlichen Prüfung: 10. Februar 2017 Erster Gutachter: Prof. Dr. Ralf H. Reussner Zweiter Gutachter: Prof. Dr. Colin Atkinson (Universität Mannheim) 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, pictures and graphs – is licensed under a Creative Commons Attribution-Share Alike 4.0 International License (CC BY-SA 4.0): https://creativecommons.org/licenses/by-sa/4.0/deed.en The cover page is licensed under a Creative Commons Attribution-No Derivatives 4.0 International License (CC BY-ND 4.0): https://creativecommons.org/licenses/by-nd/4.0/deed.en Print on Demand 2019 – Gedruckt auf FSC-zertifiziertem Papier ISSN 1867-0067 ISBN 978-3-7315-0783-3 DOI: 10.5445/KSP/1000081447 Abstract To develop complex software systems, source code and other artefacts, such as architectural models and behaviour descriptions, are used. Keeping these software architecture-based models consistent with the systems’ source code during software development and software evolution helps software architects. Having up-to-date architecture models eases the development and evolution tasks since questions such as how and where to add new features in the software systems can be answered more easily. Furthermore, it is possible to predict the performance of a software system with architecture models that include behavioural specications, such as the Palladio approach. Architecture drift and architecture erosion are, however, two well-known problems that can arise during architecture-based software development and software evolution. These problems arise when software architecture models are not kept consistent with the source code, e.g. when code is evolved without updating the architecture accordingly. Eventually, this leads to out-dated and thus useless architecture models. Most existing solutions to avoid these problems either focus on keeping UML class diagrams and source code consistent during software evolution, or embed architectural information into the source code to avoid the need of consistency preservation. In this thesis, we introduce a novel approach to keep high-level component- based architecture models consistent with source code during software de- velopment and software evolution. In particular, the approach can be used to keep instances of the Palladio Component Model (PCM) consistent with Java source code. To do so, the architectural elements are created, changed, or deleted as soon as their corresponding source code elements have been i Abstract changed and vice versa. We also present a change-driven consistency preser- vation process that preserves consistency based on user-dened change- driven consistency preservation rules between the architectural model and source code. We introduce four dierent sets of consistency preservation rules between architectural models and source code, which are realised in our prototypical implementation. Within the consistency preservation pro- cess, we introduce a user disambiguation concept, which can be used if the consistency preservation cannot be achieved automatically. In this case, users need to clarify how consistency can be achieved. As the presented approach is a change-driven approach, we need to retrieve each change performed in the involved architectural editors and the source code editors. To enable users to reuse existing editors, which with they are familiar, we implemented monitors for the Eclipse Java source code editor and PCM architectural model editors. The presented approach enables, furthermore, users to keep source code consistent with behavioural architectural models as well. Therefore, we have implemented an approach that incrementally reverse-engineers the PCM Service Eect Specications based on changes performed to source code methods. The Service Eect Specications are used to describe the behaviour of components. For reusing existing source code and existing architectural models within the presented approach, we present dierent integration strategies. For architectural models, we present an approach that simulates the creation of architectural models. During the creation, we monitor the emerging changes and use them as base for the creation of the corresponding source code. For source code, we propose an approach that uses reverse engineering tools to create an architectural model, which can be integrated to the consistency preservation approach presented in this thesis. Arbitrary code, however, is seldom build according to the dened consistency preservation rules. To deal with this fact, we present an approach that is able to deal with integrated source code for which the actual consistency preservation rules cannot be used. The approach is able to keep even those elements consistent using spe- cic consistency preservation rules for integrated source code elements. We have evaluated the presented approach in dierent case studies. We showed that it is possible to integrate existing architectural models by sim- ulating their creation. Within the performed case study, we were able to integrate between 98 % and 100 % of the supported elements for the dierent consistency preservation rules. Next, we evaluated the integration of existing ii Abstract source code and showed that it is possible to keep changes to source code consistent with the architecture and vice versa. Therefore, we integrated four open source projects into the presented coevolution approach. We showed that changes performed to source code are kept consistent with the architectural model, by integrating an old version from the Version Con- trol System (VCS) and replayed changes to a newer version using a change replay tool. During this evaluation, we also showed that the presented ap- proach is able to keep changes performed to method bodies consistent with the behavioural model. We also conducted a performance evaluation to measure the overhead of the presented change-driven approach during the software evolution. We showed that the presented approach is in most cases able to keep the architectural model consistent with changes performed to the source code within one to ve seconds. Finally, we evaluated that the coevolved architectural models can be used for performance prediction. Therefore, we rst parameterised the models with resource demands. After the parameterisation step, we execute the performance prediction using the performance prediction capabilities of the PCM. To analyse the accuracy of the performance prediction, we compared the predicted value with actual measured values. In our case study, we observed a prediction error for the response time of approximately 10 %, so that the coevolved models can be used to estimate the performance of the real software system. iii Zusammenfassung Zur Entwicklung komplexer Softwaresysteme, werden neben dem Quelltext zusätzliche Artefakte, wie beispielsweise Architekturmodelle, verwendet. Wenn die verwendeten Architekturmodelle während der Entwicklung und Evolution eines Softwaresystems konsistent mit dem Quelltext sind, kön- nen Softwarearchitekten und Softwareentwickler bei der Entwicklung der Systeme besser unterstützt werden. Architekturmodelle, die auf dem aktuellem Stand sind, vereinfachen Ent- wicklungs-und Evolutionssaufgaben, da einfacher beantwortet werden kann wie und wo neue Funktionen implementiert werden sollen. Außerdem ist es möglich, modellbasierte Analysen mit Hilfe der Softwarearchitekturmodelle vorzunehmen. Beispielsweise können mit dem Palladio Komponentenmodell (PCM) Performanzvorhersagen durchgeführt werden, wenn ein Architektur- modell des Softwaresystems vorhanden ist und dieses Verhaltensspezika- tionen beinhaltet. Wenn Architekturmodelle bei der Softwareentwicklung und Softwareevo- lution verwendet werden, können die beiden bekannten Probleme Archi- tekturdrift und Architekturverletzung auftreten. Diese Probleme treten für gewöhnlich auf, wenn bei voranschreitender Entwicklung des Quelltextes die Architektur nicht konsistent zu diesem gehalten wird. Dies führt zu veralteten und schlussendlich nutzlosen Architekturmodellen. Viele existierende Ansätze, zur Vermeidung dieser Probleme, zielen darauf ab, Quelltext und UML-Klassendiagramme konsistent zu halten, oder sie zielen darauf ab, Architekturinformationen in den Quelltext einzubetten. In letzterem Fall wird die Notwendigkeit, die Architektur konsistent mit dem Quelltext zu halten, umgangen, da die Architektur integraler Bestandteil des Quelltextes ist. v Zusammenfassung In der vorliegenden Dissertation beschreiben wir einen neuen