Next: 4 Open questions
Up: 3 Position: Compose software
Previous: 3.1 Definition composition operators
This leads us to the central definitions in our model of extensible software systems. We regard software extension as a sequence of applications of composition operators in a software composition system.
Definition 616 (Software cocktail mixer)
A software cocktail mixer is a system M=(D,U,O) with definition-universe D, use-universe U, and a finite set of definition composition operators O. If all are commutative, M is called commutative.
A software cocktail mixer provides the framework in which users can combine and extend software by sequences of composition operations. Software is written by composing component-definitions. Software is extended by new applications of view merge operators. Thus the user writes software by mixing composition operators and definitions to a software cocktail:
Definition 626 (Software cocktail)
A software cocktail is a system C=( M =(D,U,O), F, QF) with definition-universe D, use-universe U, a finite set of definition composition operators O, a composition forest F of operator applications, and a view-resolved composition sequence QF. If all are commutative, C is called commutative.
With software cocktails, because composition forests and linearizations are given, compilers can recalculate view mappings:
Theorem 633 (Recompilation of view mappings)
Let C=(D,U,O,F,QF) be a software cocktail. If U, O, or F is extended, all component-uses need not be edited, only the get-functions needs to be recalculated.
If the composition operators are commutative, arbitrary linearizations of composition forests may be chosen for a software cocktail.
Theorem 638 (Uniqueness vs. permutations)
Let C=(D,U,O,F,QF) be a commutative software cocktail. Then Q'F(D)=QF(D) for any other linearization Q'F of F.
The theorem says that, for software cocktails with commutative operators, the application order of the compositions is not important. All linearizations of a composition forest lead to the same final layout of all components. Even more, if subcomponent-sets are unordered, the compiler may choose an arbitrary layout, containing all collected subcomponents.
This influences the calculation of the subcomponent-projection get. Because the view mapping is independent of the ordering of composition operations, it can be calculated on any linearization of the composition forest. This is expressed in the following theorem.
Corollary 646
Let C=(D,U,O,F,QF) be a commutative software cocktail. Let be a component-definition visible at a component-use .
Then for the value of the subcomponent-projection get(u,d,f) is the same for any other linearization Q'F of F.
If all component-definitions have the same name, i.e. only views of one component are described, a commutative software cocktail collapses to a finite powerset product lattice on the subcomponent-sets. In such a lattice composition operators are distributive lattice functions, and are combined of basic set functions. The top of the lattice is the view-resolved final layout of the component, the bottom the empty view.
In order to calculate a view mapping a non-commutative software cocktail,
the compiler has to
take into account the user-specified application order.
Example
6 In case of multiple inheritance the inheritance operator on object
attributes can be represented by catenation of attribute lists, together
with overwriting of multiply inherited features. As this operation is not
commutative, the order in which multiple inheritance is expanded is
important for language semantics.
Uwe Assmann and Rainer Schmidt