· “Design patterns constitute a set of rules describing how to accomplish
certain tasks in the realm of software development.” (Pree 1994)
“Design patterns focus more on reuse of recurring architectural design
themes, while frameworks focus on detailed design and
implementation.” (Coplien and Schmidt 1995)
“A pattern addresses a recurring design problem that arises in specific
design situations and presents a solution to it.” (Buschmann et al.
“Patterns identify and specify abstractions that are above the level of
single classes and instances, or of components.” (Gamma et al., 1993)
But while it is helpful to draw analogies to architecture, cabinet making,
and logic, design patterns are not just about the design of objects but about
the interaction between objects. One possible view of some of these
patterns is to consider them as communication patterns.
Some other patterns deal not just with object communication but with
strategies for object inheritance and containment. It is the design of
simple, but elegant, methods of interaction that makes many design
patterns so important.
Design patterns can exist at many levels from very low-level specific
solutions to broadly generalized system issues. There are now hundreds of
patterns in the literature. They have been discussed in articles and at
conferences of all levels of granularity. Some are examples that apply
widely, and a few writers have ascribed pattern behavior to class
groupings that apply to just a single problem (Kurata 1998).
It has become apparent that you don’t just write a design pattern off the
top of your head. In fact, most such patterns are discovered rather than
written. The process of looking for these patterns is called “pattern
mining,” and it is worthy of a book of its own.
The 23 design patterns selected for inclusion in the original Design
Patterns
book were those that had several known applications and that
Creational patterns create objects for you rather than having you
instantiate objects directly. This gives your program more flexibility in
deciding which objects need to be created for a given case.
Structural patterns help you compose groups of objects into larger
structures, such as complex user interfaces or accounting data.
Behavioral patterns help you define the communication between
objects in your system and how the flow is controlled in a complex
program.
We’ll be looking at C# versions of these patterns in the chapters that
follow, and we will provide at least one complete C# program for each of
the 23 patterns. This way yo u can examine the code snippets we provide
and also run, edit, and modify the complete working programs on the
accompanying CD-ROM. You’ll find a list of all the programs on the CDROM
at the end of each pattern description.