This
chapter introduces the important and yet non-traditional “patterns”
approach to program design.
Probably
the most important step forward in object-oriented design is the “design
patterns” movement, chronicled in Design
Patterns
,
by Gamma, Helm, Johnson & Vlissides (Addison-Wesley 1995).
[70]
That book shows 23 different solutions to particular classes of problems. In
this chapter, the basic concepts of design patterns will be introduced along
with several examples. This should whet your appetite to read
Design
Patterns
(a source of what has now become an essential, almost mandatory, vocabulary for
OOP programmers).
The
latter part of this chapter contains an example of the design evolution
process, starting with an initial solution and moving through the logic and
process of evolving the solution to more appropriate designs. The program shown
(a trash sorting simulation) has evolved over time, and you can look at that
evolution as a prototype for the way your own design can start as an adequate
solution to a particular problem and evolve into a flexible approach to a class
of problems.