5 Pattern Complements

Nothing is more dangerous than an idea,when you have but one idea.

Émile-Auguste Chartier

A complement is something that makes another thing complete in some way. In this chapter we look at how this notion can apply to patterns. First, we see how two or more patterns can enrich a design process by offering contrast and competition between alternative solutions to similar problems. Next, we look at how one pattern can complete the design of another. Last, we see how these two views of complements—process and structure, competitive and cooperative—are not necessarily so very different, by illustrating how competing patterns can cooperate and be combined.

5.1 More than One Solution to a Problem

There is a common perception among many developers that certain types of problems are resolved by only a single pattern [BuHe03] [Bus03a]. This perception is sometimes reinforced in the naming of particular patterns. For example, collection iteration problems can be addressed by ITERATOR, object adaptation problems are addressed by ADAPTER, stateful object lifecycle problems are addressed by OBJECTS FOR STATES, and so on, as we also discussed in Section 0.2, A Story of Success… with Some Exceptions.

The idea that one problem maps to one solution acts as a security blanket for some pattern users, since it seems to make life simpler. In particular, the lack of choice and variation is seen as a strength rather than a weakness, since it eliminates design choice and with ...

Get Pattern Oriented Software Architecture Volume 5: On Patterns and Pattern Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.