Feature-oriented Programming - AHEAD

AHEAD

Algebraic Hierarchical Equations for Application Design (AHEAD) generalized GenVoca in two ways. First it revealed the internal structure of GenVoca values as tuples. Every program has multiple representations, such as source, documentation, bytecode, and makefiles. A GenVoca value is a tuple of program representations. In a product line of parsers, for example, a base parser f is defined by its grammar gf, Java source sf, and documentation df. Program f is modeled by the tuple f=. Each program representation may have subrepresentations, and they too may have subrepresentations, recursively. In general, a GenVoca value is a tuple of nested tuples that define a hierarchy of representations for a particular program.

Example. Suppose terminal representations are files. In AHEAD, grammar gf corresponds to a single BNF file, source sf corresponds to a tuple of Java files, and documentation df is a tuple of HTML files . A GenVoca value (nested tuples) can be depicted as a directed graph: the graph for program f is shown in the figure to the right. Arrows denote projections, i.e., mappings from a tuple to one of its components. AHEAD implements tuples as file directories, so f is a directory containing file gf and subdirectories sf and df. Similarly, directory sf contains files c1…cn, and directory df contains files h1…hk.
Note: Files can be hierarchically decomposed further. Each Java class can be decomposed into a tuple of members and other class declarations (e.g., initialization blocks, etc.).

Second, AHEAD expresses features as nested tuples of unary functions called deltas. Deltas can be program refinements (semantics-preserving transformations), extensions (semantics-extending transformations), or interactions (semantics-altering transformations). We use the neutral term “delta” to represent all of these possibilities, as each occurs in FOSD.

To illustrate, suppose feature j extends a grammar by gj (new rules and tokens are added), extends source code by sj (new classes and members are added and existing methods are modified), and extends documentation by dj. The tuple of deltas for feature j is modeled by j=, which we call a delta tuple. Elements of delta tuples can themselves be delta tuples. As an example, sj represents the changes that are made to each class in sf by feature j, i.e., sj=. The representations of a program are computed recursively by composing tuples element-wise. The representations for parser p (whose GenVoca expression is j•f) are:

p2 = j • f -- GenVoca expression = • -- substitution = -- compose tuples element-wise

That is, the grammar of p is the base grammar composed with its extension (gj•gf), the source of p is the base source composed with its extension (sj•sf), and so on. As elements of delta tuples can themselves be delta tuples, composition recurses, e.g., sj•sf= •=. Summarizing, GenVoca values are nested tuples of program artifacts, and features are nested delta tuples, where • recursively composes them. This is the essence of AHEAD.

The ideas presented above concretely expose two FOSD principles. The Principle of Uniformity states that all program artifacts are treated and refined in the same way. (This is evidenced by deltas for different artifact types above). The Principle of Scalability states all levels of abstractions are treated uniformly. (This gives rise to the hierarchical nesting of tuples above).

The original implementation of AHEAD is the AHEAD Tool Suite and Jak language, which exhibits both the Principles of Uniformity and Scalability. Next-generation tools include CIDE and FeatureHouse.

Read more about this topic:  Feature-oriented Programming