Merging of Modelsproject leader: Prof. Dr. Bernhard Westfechtel
projectstart: 2012 financier: state funding
The importance of models in contemporary software engineering has grown over the last years. Originally they served for documentation purposes and were created and modified simultaneously with the software system in question. Currently, a paradigm shift towards model-driven software engineering lifts models up to “first class software artifacts”, which promises to increase productivity by generating source code out of models such as UML class diagrams. This reduces implementation effort by deferring a bulk of design decisions up to the modeling level of abstraction. The Eclipse modeling framework (EMF) is a widespread platform for modeling tools which has not only gained acceptance in academia. The XMI (XML metadata interchange) format defines a unified serialization mechanism for models based on XML.
Version control systems are indispensable in most software development teams. They allow for the co-existence of several versions of the same software artifact by providing a repository to synchronize these versions. As soon as multiple versions of the same software artifact exist at the same time, concurrent changes can lead to conflicts. Two distinct solutions are known for this problem: Pessimistic versioning strategies restrict write access to one developer and thus prevent the artifact from co-existing in different versions. Optimistic strategies, however, primarily allow for concurrent (local) modifications, but in case of conflicts, the change provided by one alternative version has to be discarded. Three-way merge algorithms take under consideration two alternative versions and additionally the most recent common base version. This allows to make a large part of merge decisions automatically. Nevertheless, in some cases user interaction is required to resolve a specific merge conflict.
Current version control systems are tailored towards source code and thus work in a line-oriented way. Multiple changes in the same line are considered an atomic modification; adding and removing a number of lines is another atomic change. This is an approximation that results in different problems when transferred to models, which are e.g. serialized as XMI files. On the one hand, the granularity ‘line’ is not adequate for models, which are composed by objects. On the other hand, models are typically much more structured than source code, and the number of nestings and cross-references to objects declared in other places is larger. Using standard version control systems, this results in inconsistent three-way merge results. In a UML class diagram, for instance, deleting a class in one version and adding an attribute in another version is a conflict that cannot be detected by comparing lines of the XMI serialization. To overcome these problems, a three-way merge algorithm is required that takes under consideration context-free and context-sensitive properties of the model versions in question.
In this research project, we develop a three-way merge approach tailored towards EMF models. The formal foundations have already been pre-published: We described different kinds of context-free and context-sensitive merge conflicts and proposed an algorithm that produces a consistent merge result. The algorithm is implemented in our research prototype “BTMerge”, which is based on EMF. Additionally, our upcoming research will cover strategies not only for the efficient and thorough detection, but also for the resolution of conflicts by the user. In contrast to existing implementations for model version control systems, our approach will be purely state-based, i.e. only the states of the model versions at merging time are considered, and not recorded or derived operation sequences that produce those versions. Consequently, our merging tool is independent from the modeling environment used. Another research topic will be the detection and resolution of semantic conflicts, which depend on the metamodel of the versions. For example, the a UML class diagram will contain a cyclic inheritance conflict when it results from a merge of two alternative versions that add generalizations between two classes in opposite directions. Last, our research prototype will be either integrated into an existing version control system or extended by additional version control capabilities such as updating, committing or branching.
Our research prototype „BTMerge“ is still under development. Stable versions are periodically made available at our Eclipse update site (see below). Our accompanying screencasts include installation instructions.
- Eclipse Juno Modeling Update Site: http://btn1x4.inf.uni-bayreuth.de/btmerge/update
- Screencasts: http://btn1x4.inf.uni-bayreuth.de/btmerge/screencasts