The Principle of Designing from Context

Alexander tells us to design from context, to create the big picture before designing the details in which our pieces appear. Most design patterns follow this approach, some to a greater extent than others. Of the four patterns I have described so far, the Bridge pattern is the best example of this.

Refer to the Bridge pattern diagram in Chapter 9, “The Bridge Pattern,” (see Figure 9-13). When deciding how to design the Implementation classes, think about their context: the way that the classes derived from the Abstraction class will use them.

For example, if I were writing a system that needed to draw shapes on different types of hardware and that therefore required different implementations, I would use ...

Get Design Patterns Explained: A New Perspective on Object-Oriented Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.