Design Patterns: Elements of Reusable Object-Oriented Software
389
Computer scientists name and catalog algorithms and data structures,but we don't
often name other kinds of patterns. Design patternsprovide a common vocabulary
for designers to use to communicate, document,and explore design alternatives.
Design patterns make a system seemless complex by letting you talk about it at
a higher level ofabstraction than that of a design notation or programming
language.Design patterns raise the level at which you design and discuss designwith
your colleagues.
Once you've absorbed the design patterns in this book, your designvocabulary will
almost certainly change. You will speak directly interms of the names of the design
patterns. You'll find yourselfsaying things like, "Let's use an Observer here,"
or, "Let's make aStrategy out of these classes."
A Documentation and Learning Aid
Knowing the design patterns in this book makes it easier to understandexisting
systems. Most large object-oriented systems use these designpatterns.
People
learning object-oriented programming often complainthat the systems they're
working with use inheritance in convolutedways and that it's difficult to follow
the flow of control. In largepart this is because they do not understand the design
patterns in thesystem. Learning these design patterns will help you
understandexisting object-oriented systems.
These design patterns can also make you a better designer. Theyprovide solutions
to common problems. If you work withobject-oriented systems long enough, you'll
probably learn thesedesign patterns on your own. But reading the book will help
you learnthem much faster. Learning these patterns will help a novice act morelike
an expert.
Moreover, describing a system in terms of the design patterns that ituses will
make it a lot easier to understand. Otherwise, people willhave to reverse-engineer
the design to unearth the patterns it uses.Having a common vocabulary means you
don't have to describe the wholedesign pattern; you can just name it and expect
your reader to knowit. A reader who doesn't know the patterns will have to look
them upat first, but that's still easier than reverse-engineering.
We use these patterns
in our own designs, and we've found theminvaluable. Yet
we use the patterns in arguably naive ways. We usethem to pick names for classes,
to think about and teach good design,and to describe designs in terms of the sequence
of design patterns weapplied [BJ94]. It's easy to imagine moresophisticated ways
of using patterns, such as pattern-based CASE toolsor hypertext documents. But
patterns are a big help even withoutsophisticated tools.