Michael VanHilst

Feature Oriented Programming: Beyond Objects

Traditional methods of object oriented programming support selective interchangeable features in the leaf nodes of a class hierarchy. Design choices, like storage allocation and communication models, are typically buried deep in an application's inheritance hierarchy, while features such as security, concurrency, and persistence typically cut across object hierarchies. Design patterns, like Factory, Visitor and Decorator, increase flexibility by adding extraneous objects and more levels of indirection. The traditional approach reflects a bias toward runtime polymorphism and black-box extension. My Feature Oriented approach, by comparison, supports interchangeablity anywhere in the object hierarchy (including multiple places at once), adds no objects beyond the domain model, uses static binding (except as dictated by runtime functionality), and helps native compiler optimization remove extraneous code.

Feature Oriented Programming encapsulates features in feature fragments, and groups of fragments. Feature fragments are easy to reuse, and are easily developed in a process of stepwise refinement. Fragments are composed at compile time to form the classes and hierarchies of a final application. A Feature Oriented approach is most useful in product-line development, or any application where requirements change. The Feature Oriented design approach, based on step-wise refinement and aggressive refactoring parallels the design approach now identified with Extreme Programming. Advantages of Feature Oriented Programming include easy reconfigurability and efficient executables.

My contributions to Feature Oriented Programming, starting with my dissertation work, include the concept of using mixin classes (stackable class templates), a detailed design methodology, and a simple method of implementation requiring only a good C++ compiler and a disciplined approach to programming. My OOPSLA'96 paper showed a natural correspondence between feature fragment layers and role, use case, and responsibility driven designs. My FSE'96 paper demonstrates the approach's easy ability to address all published configuration challenges for Parnas' original KWIC application. My dissertation describes the design methodology in detail, and lists a large number of ideoms to address a variety of issues.

Since the original work was published, interest has been growing. In a paper at PLDI'01, Emery Berger (UMass, Amherst), showed that by using my method to build families of memory allocators, the resulting code could be more efficient than equivalent hand-crafted C code, due to synergies with compiler optimization. In a paper at ICSE'01, Richard Cardone (UTexas, Austin) compared the approach to Doug Schmidt's implementation of the ACE framework. Yannis Smaragdakis (Georgia Tech) reduced potential complexity by using nested classes to implement the fragments, while Krzysztof Czarnecki (Daimler Chrysler) reduced the complexity by using nested classes to specify the composition. Don Batory has incorporated the approach in his latest generator technology. Many of the Batory and Smaragdakis papers compare their approach to a graph application presented in my ISOTAS'96 paper. Richard Cardone's JL, Sean McDirmid's Jiazzi, and Don Batory's JTS/Jak are all preprocessors designed to support the same style of programming in Java.

In the future, I hope to explore the use of Feature Oriented Programming for embedded systems and software/hardware co-design. Embedded systems are often implemented in product-line families, and place a premium on small efficient implementations. In addition, I plan to explore the ability to compose test suites and models for formal verification using the same specifications of configuration used to build the application (or application component) from feature fragments.