A Quick Tutorial on  FeatureHouse and FeatureIDE


FeatureIDE is an Eclipse plug-in that provides IDE support for a number of Feature-Oriented Software Development (FOSD) tools.  This tutorial is aimed at using the FeatureHouse (FH) tool.  It is assumed that the basic ideas of FH are known. 

 

Here is a zip file for the entire project.


The Example

Suppose we have an elementary software product line (SPL) with a base feature and two independent and optional features more and last.  The feature model of this software product line (SPL) is shown below:


The base feature defines a single Java file, Main.  The optional features extend Main.  Their Java source is given in the table below:

base

more

last

public class Main {
    String base;
 
    Main() {  base = "base"; }
 
    void print() { 
       System.out.println( base ); 
    }
 
    /*****************/
  
    static Main me;
 
    public static void main( String[] args ) {
      me = new Main();
      me.print();
    }
}
class Main {
    String more;
 
    Main() { more = "more"; }
 
    void print() {
        original();
        System.out.println( more );
    }

}

class Main {
    static String last;

    Main() { last = "last"; }

    static void main( String[] args ) {
       original( args );
       System.out.println( last );
    }
}

 

 

This example was chosen to illustrate the basic capabilities of FH, which is most of what you need. 
  1. Field and method introduction
  2. Static and non-static method wrappings
  3. Constructor extensions

What is missing in this example is the ability to override (replace) an existing method. If you need to do this, just don’t reference 
original() in the overriding method body.

 

There are 4 possible products (programs) in this SPL.  The table below lists each configuration/program and the output that programs’ execution:

ConfigurationOutput
base“base”
base + more“base more”
base + last“base last”
base + more + last“base more last”


Creating a FH Project in FeatureIDE

This video shows: 
  1. Activate the FeatureIDE perspective in Eclipse
  2. Create a FH project
  3. Create the feature diagram (shown above)
  4. After step 3, a directory is created for each feature

Some notes: 
  1. To do anything with FeatureIDE requires you to use its perspective
  2.  The feature diagram tool, IMO, is really nice – intuitive and easy to use.  Or at least, compared to its competitors J
  3.  After drawing the feature diagram, save the file (or close it).  FeatureIDE does nothing until you update files.  This is unlike normal Eclipse editing, where if you edit a Java file without saving it, Eclipse takes the version that is in its editor buffers.  Not so for FeatureIDE – if you change a Java file, FeatureIDE uses the most recently saved version.  Always keep this in mind.
  4.  Should you change your feature diagram (e.g., by renaming features or adding new features), it seems that feature directories are appropriately renamed and new feature directories are created.  As I don’t know this is the case with absolute certainty, be careful!
Watch this MP4 video on how to create a Feature House Project.


Adding Source Files and Configuring a FH Product

This video shows: 
  1. How to add files to each feature directory (a.k.a module)
  2. How to configure a product of the SPL
  3. How to produce a product and run it

Some notes:
  1.  Creating files is easy
  2.  A configuration is the selection (and deselection) of features from the feature model/feature diagram.  There is a default.config file which you simply select the features that you want.  Feature selections are guided by the constraints in your (previously defined) feature model/feature diagram.  The figure below shows the selection of the base and last features:

    ·         

    Once you save your configuration, FeatureIDE automatically builds the corresponding product in directory src/.  In this video, you’ll see that I made an error.  The base feature originally defined the main method as:  “public static void main(String[] args)”.  However, the last feature redefined the method as “static void main(String[] args)” – which declared the main() method no longer public.  You’ll see Eclipse report the error, and my repair of this error.
  3. Altering the configuration file allows you to build different programs of this SPL.  Please note that builds are automatic – everytime FeatureIDE sees a file change, it rebuilds the product.  Should this not happen, make sure that Project-> Build Automatically is selected.

Watch this MP4 video on how to Build a Feature House Project.