A guide to creating efficient variants
FeatureIDE - A novel approach to developing software - Part 2
Feature IDE by Example
The basic idea of FeatureIDE is to develop every feature separately. Variants can afterwards be generated automatically by selecting and combining the desired features. We show how this works with a small calculator example.
Mapping Code to Features
In FeatureIDE, the whole application is divided into parts representing different features. While this may sound similar to the concept of classes there is an important difference. A feature in our sense always represents a certain aspect of the application with meaning to the end-user, e.g., the operations Addition and Multiplication are features, because it makes a difference to the user whether these operations are included in the final product.
Every feature can be related to an arbitrary number of software artefacts. In FeatureIDE, these artefacts can be classes, methods, fields or even single statements as well as additional resources like graphics or user-documentation. Especially, the option to change only parts of a method offers great flexibility in the design of features. Figure 1 shows the mapping of features to code in our example. Columns are related to the features and rows are related to classes or other documents.The cells contain more detailed information about the artefacts that belong to the particular feature.
Figure 1: Mapping Code to Features
We can see that the feature Addition contains three methods and one field in the Calculator class.The class Addition Operation is also introduced by the feature Addition. Feature Graphical contains the User Interface class, which contains five methods and two fields.
Implementation of Features
Figure 2 shows the source code of the features Addition and Multiplication. Feature Addition introduces the methods initCalculator() and initUI(), which contain functionality to supply our calculator with an addition operation. Both methods are extended by the feature Multiplication in order to extend the calculator with a multiplication operation. We use the keyword original() to access the original method, as it is defined in feature Addition. The keyword original() is similar to the keyword super(), but does refer to a member of another feature instead of a member of the superclass.
Figure 2: Feature Implementation