Software Product Line Engineering (SPLE) defines a method to develop a set of related software applications by explicitly managing their common and variable features. Single product features are mapped to specific realisation artefacts of the Software Product Line. Thus, a concrete application can be automatically derived, by removing all realisation artefacts which are not mapped to features selected for the product variant.
To map realisation artefacts in accordance to specific features, traditionally annotation techniques like #ifdef statements, Frames, and Traits or composition techniques like mixin layers, aspects, CaesarJ, or AHEAD are used. While annotation techniques do not consider the structure of the annotated implementation language and, thus, can not assure the correctness of the resulting source code, compositional approaches are restricted to a coarse module granularity and can not represent fine granular feature realisations. All techniques share the common drawback that they do not provide good tool support for defining and maintaining feature mappings. In addition, the lacking tool support makes it hard for developers to comprehend feature mappings.
The tool FeatureMapper provides a visual paradigm for mapping features to artefacts of EMF-based modelling languages. JaMoPP now enables the application of the FeatureMapper to the Java language and targets the problems of the aforementioned mapping paradigms.
Figure 1 depicts a screenshot of the FeatureMapper. The MappingView on the left (1) displays the features of a product line. EMFText's editor (2) shows a Java file. Mappings can be created by assigning code elements to features. Here the level of detail in the Java metamodel introduced by JaMoPP is of key importance. The selectable code elements comply to the granularity of the metaclasses. A concrete selection and the result of its removal from the source code can be checked for well-formedness regarding the Java metamodel. This makes the mapping as fine granular as annotation based mappings and as safe as in compositional approaches.
To address the problem of comprehensibly for developers the FeatureMapper provides several visualisation techniques. Figure 1 depicts one example–the context view. This visualisation colours the elements in the source code in accordance to the colour of the features in the feature model they are mapped to. This allows to investigate how features are realised in different product variants and how feature realisations interact. The example shows two variants of the ContactList. Source code elements highlighted in a darker shade belong to a variant of the ContactList were Contacts are managed in Groups. The Java code elements in a brighter shade represent the implementation of a simplified ContactList without the Feature Groups.
The presented example shows how the model-based representation of Java code provided by JaMoPP enables a SPLE tool developed for modelling languages to be used at implementation level.