What is Design Patterns?
“A solution to a problem in a context” - Christopher Alexander
A pattern involves 4 items
- The name of the pattern
- The purpose of the pattern, the probem it solves
- How we could accomplish this
- The constraints and forces we have to consider in order to accomplish it
Motivations for studying Design Patterns
- Resue solutions
- Establish common terminology
- Help raise the level of your thinking
In the third point: Patterns give you a higher-level perspective on the problem
and on the process of design and object orientation. This frees you from the
tyranny of dealing with the details too early.
The GoF suggests some strategies for creating good OO designs
- Design to interfaces
- Favor composition over inheritance
- Find what varies and encapsulate it