Annex B: Design Patterns
When we wish to represent a tree structure or to mask the differences between composite and simple objects of similar nature, the composite pattern proposes the definition of a unified interface of simple and composite objects.
Structure and Components
Structure and Components of the Composite design pattern 1
Structure and Components of the Composite design pattern 2
The clients handle a component through its general interface. A leaf directly executes the operations required, whereas a composite transfers the requests to its children by performing the additional actions prior or after their transfer.
Collaborations of the Composite design pattern
Strengths and Weaknesses
arborescent structuring of objects: a composite which joins together sub-components can be integrated in a composite,
encapsulation of the heterogeneity of simple and composite objects: a composite object can be used in the place of a simple object and vice versa,
facilitated integration of new classes of composite or simple objects which can be combined in a stable way,
necessity to dynamically control particular constraints in the composition of objects within a composite,
the maximisation of the general interface of a component (necessary for the encapsulation) can bring to the declaration of methods which do not make sense for simple objects.
Use in CBR*Tools
This pattern is used to represent in a structured way the indices, the similarities, the case bases and the indices.
Last modified: Fri Sep 28 13:51:40 MEST 2001