-
Designing object-oriented software is hard, and designing reusable object-oriented software is even harder.
-
The design patterns in this book are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.
-
Class patterns deal with relationships between classes and their subclasses.
-
These relationships are established through inheritance, so they are static, fixed at compile-time.
-
Object patterns deal with object relationships, which can be changed at run-time and are more dynamic.
- Creational class patterns defer some part of object creation to subclasses, while Creational object patterns defer it to another object
- The Structural class patterns use inheritance to compose classes, while the Structural object patterns describe ways to assemble objects
- The Behavioral class patterns use inheritance to describe algorithms and flow of control, whereas the Behavioral object patterns describe how a group of objects cooperate to perform a task that no single object can carry out alone
-
Composite is often used with an Iterator or Visitor.
-
Some patterns are alternatives: Prototype is often an alternative to Abstract Factory.
-
Some patterns result in similar designs even though the patterns have different intents. For example, the structure diagrams of Composite and Decorator are similar.