Chap.9: MISSING PATTERNS


Reference [4] lists several structural patterns which are simple inheritance trees applied to some particular situations. Since there is no other structure involved (collections or pointers), these patterns are not good candidates for this library. When working with these patterns, the main work is in setting up application-specific functions, and this work must be done by the user whether or not there is a library class.

For this reason, the following patterns are not included in this library: Adapter, Bridge.

Another reason for not including some other patterns is that they can be implemented easily with patterns that are already available. For example, from the structural point of view, Decorator is just Composite except for a few additional subclasses:

When you need a Decorator, simply use Composite from the library, and derive classes D and E from C.

Our plan is to gradually expand this library depending on user needs and requirements. Probably, we will introduce the following classes in the near future:

  • CONTAINER
    will be derived from PtrArray<>, and provide one class for all the containers typically provided in other libraries: collection, ordered collection, vector, set, bag, etc. It will also have an iterator which is not provided for Array and PtrArray.
  • TREE
    will be derived from Aggregate<>, with iterators for depthFirst and breadthFirst search. The search function will execute a user coded function for each object in the tree, and abort when this function returns 1.
  • MANY_TO_MANY RELATION
    will use 3 classes: Source, Relation, and Target, with aggregates between Source and Relations, and between Target and Relation.