Doctoral thesis
Cite …

Specification Languages for Preserving Consistency between Models of Different Languages

Abstract

In this thesis, we present three languages for the development of tools that keep different system representations consistent during software development.

When complex IT systems are developed, it is common practice to use several programming and modelling languages. System parts are designed and represented using different languages in order to support various design and development tasks. The overall structure of a system, for example, is often represented with an architectural description language. To specify the detailed behavior of individual system parts, a state-based modelling language or a general purpose programming language are, however, more appropriate. As these system parts and development tasks are related, these representations often also contain redundant information. Such partially redundant representations are usually not used in a static way but evolve during system development, which can lead to inconsistencies that yield faulty designs and implementations. Therefore, consistent system representations are crucial for the development of such systems.

There are various approaches to achieve consistent system representations by avoiding inconsistencies. It is possible, for example, to create a central, redundancy-free representation that encompasses all information so that all other representations can be projected from it. Creating such a redundancy-free representation and editable projections is, however, not always feasible, especially if existing languages and editors have to be supported. Another possibility to evade inconsistencies is to only allow modifications for a piece of information at a unique source representation so that all other representations can only read this information. This makes it possible to always override such information in all read-only representations, but it also makes it necessary to completely isolate all editable regions of representations.

If inconsistent representations cannot be completely avoided during system development, developers or tools have to actively preserve consistency when representations are modified. Manual consistency preservation is, however, a time-consuming and errorprone task. Therefore, consistency preservation tools that semi-automatically update models during system development are developed in academia and industry. Such special software engineering tools can be developed with general purpose programming languages and with dedicated languages for consistency preservation.

In this thesis, we have identified four major challenges that are currently only insufficiently addressed by languages for developing consistency preservation tools. First, these languages do not combine specific consistency preservation support with the expressive power and flexibility of established general purpose programming languages. Therefore, developers are either restricted to designated use cases or have to repeatedly develop solutions to generic consistency preservation problems. Second, these languages either support solution- or problem-oriented programming paradigms, which forces developers to also provide preservation instructions for cases in which consistency declarations would be sufficient. Third, these languages do not abstract away from enough consistency preservation details, which requires developers to explicitly consider, for example, preservation directions, change types, or matching problems. Last, these languages yield preservation behavior that often appears to be detached from the specific use case when interpreters and compilers run or generate code that is not needed to realize a particular consistency specification.

To address these issues of current approaches, this thesis makes the following contributions: First, we present a collection and classification of consistency preservation challenges and discuss, for example, which challenges should not be addressed when consistency is specified but only when it is enforced. Second, we introduce an approach for preserving consistency according to abstract specifications and formalize it using set theory. This formalization is independent of how consistency enforcement is finally realized. With the presented approach, consistency is always preserved according to monitored edit operations in order to avoid well-known matching and diffing problems. Last, we contribute three new languages for the development of tools that follow this specification-driven approach and which we briefly explain in the following.

We present an imperative language that can be used to precisely define how models have to be updated in reaction to specific changes in order to preserve consistency in one direction. This reactions language provides solutions to common problems, such as identifying and retrieving changed or corresponding model elements. Furthermore, it achieves unlimited expressive power as it allows developers to fallback to a general purpose programming language. A second, bidirectional language for abstract mappings can be used for cases in which different edit operations do not need to be distinguished and preservation directions are not always relevant. With this mappings language, developers can declare conditions for model elements that should be considered consistent without bothering about details of checking and enforcing consistency. For this, the compiler automatically derives enforcement code from checks and bidirectionalizes conditions that are specified for one consistency preservation direction. This bidirectionalization is based on an extensible set of composable, operator-specific inverters that fulfill common roundtrip requirements. As a result, developers can express common consistency requirements concisely and do not need to repeat code for different consistency preservation directions, change types, or properties of model elements. A third, normative language can be used to complete the previous ones with parameterized consistency invariants. This invariants language adopts collection operators and iterators from the Object Constraint Language (OCL). Furthermore, it relieves developers from writing code that searches for invariant-violating elements as queries that perform this task are automatically derived for invariant parameters. The three languages can be used in combination or individually. They give developers the possibility to specify consistency using different programming paradigms and language abstractions. We also present prototypical compilers and editors for the three consistency specification languages based on the multi-view modelling framework Vitruvius. With this framework, changes in textual and graphical editors are automatically monitored to trigger reactions, to enforce mappings, and to check invariants by executing the Java source code that is produced by our compilers.

For all languages presented in this thesis, we have evaluated theoretical completeness and correctness as well as practical applicability and benefits. We show that the languages completely cover the intended range of use and analyze their computational completeness. Furthermore, we discuss correctness for each language individually and for specific language features. The operator-specific inverters that we have developed to bidirectionalize mapping conditions, for example, always fulfill a new notion of best-possible behaved round-trips. It is based on the established notion of well-behaved transformations2 and guarantees that common round-trip laws are fulfilled whenever this is possible. We demonstrate the practical applicability with case studies in which consistency was successfully preserved with tools that were written using the presented languages. Finally, we discuss potential benefits of the languages and compare, for example, consistency preservation tools that were realized in two case studies. Those tools that were developed using the reactions language have between 33% and 71% fewer source lines of code than functionally equivalent tools that were written in Java or the Java dialect Xtend.