Feature-oriented Programming - GenVoca

GenVoca (a meld of the names Genesis and Avoca) is a compositional paradigm for defining programs of a product lines. Base programs are 0-ary functions or transformations called values:

f -- base program with feature f h -- base program with feature h

and features are unary functions/transformations that elaborate (modify, extend, refine) a program:

i • x -- adds feature i to program x j • x -- adds feature j to program x

where • denotes function composition. The design of a program is a named expression, e.g.:

p1 = j • f -- program p1 has features j and f p2 = j • h -- program p2 has features j and h p3 = i • j • h -- program p3 has features i, j, and h

A GenVoca model of a domain or software product line is a collection of base programs and features (see MetaModels and Program Cubes). The programs (expressions) that can be created defines a product line. Expression optimization is program design optimization, and expression evaluation is program synthesis.

Note: GenVoca is based on the stepwise development of programs: a process that emphasizes design simplicity and understandability, which are key to program comprehension and automated program construction. Consider program p3 above: it begins with base program h, then feature j is added (read: the functionality of feature j is added to the codebase of h), and finally feature i is added (read: the functionality of feature i is added to the codebase of j•h).
Note: not all combinations of features are meaningful. Feature models (which can be translated into propositional formulas) are graphical representations that define legal combinations of features.
Note: A more recent formulation of GenVoca is symmetric: there is only one base program, 0 (the empty program), and all features are unary functions. This suggests the interpretation that GenVoca composes program structures by superposition, the idea that complex structures are composed by superimposing simpler structures. Yet another reformulation of GenVoca is as a monoid: a GenVoca model is a set of features with a composition operation (•); composition is associative and there is an identity element (namely 1, the identity function). Although all compositions are possible, not all are meaningful as mentioned above.

GenVoca features were originally implemented using C preprocessor (#ifdef feature ... #endif) techniques. A more advanced technique, called mixin layers, showed the connection of features to object-oriented collaboration-based designs.

Read more about this topic:  Feature-oriented Programming