Design Patterns 314
Design Patterns | |
author | Erich Gamma, et al |
pages | 395 |
publisher | Addison-Wesley |
rating | 8 |
reviewer | Ben Shive |
ISBN | 0201633612 |
summary | Design Patterns is considered a classic for anyone in software development. Many of the professionals out there probably already own a well-used copy of this book, but there are others who are wondering what all the fuss is about. |
Introduction
I found the entire introductory section excellent, and a good read. It covers
what design patterns
are and explains how they are documented and categorized. Advice on where
and how to employ design patterns to achieve reusable and flexible software
is also covered to give you an expectation of what you can get out of the rest
of the book. The What, Why, and How are
covered nicely. Even with little previous exposure to patterns, I was able to
understand the presented material easily and begin to see the applications.
Object
Modeling Technique (OMT) notation is also introduced to explain the diagrams
associated with the patterns and examples. If you have used UML,
the diagrams and notations will be familiar to you since UML is influenced by
OMT. Jim Rumbaugh,
the creator of OMT, collaborated with Grady
Booch to create the first version of UML.
As the author notes, having a solid knowledge of OOP is critical to being able to understand and use the information presented. If you don't fully understand OOP, pick up an introductory text first. An Introduction to Object-Oriented Programming by Timothy A. Budd or any similar book will get you up to speed. However, you will get the most out of Design Patterns with hands-on OOP experience.
Case Study
This chapter presents a case study in designing a WYSIWYG document editor to demonstrate how design patterns can be applied. Most of the examples in the book involve the user interface and I would have liked to see less emphasis on UI models. However, it still gives the reader insight into real applications of patterns. Not only do the authors point out how the pattern applies to each case, but they also present the problems associated with the application. The case study is not intended to set up a perfect example of pattern usage, but to explore it. The reader could go further with the design presented and think about how to solve the flaws pointed out along with the ones that have not been discussed. I liked the fact that they do not attempt to state that there is only one way to solve the problems presented, or that their solutions are even the best way. Too many authors fall into this trap.
Presenting: The Patterns
The three chapters on patterns make up the bulk of the book. The patterns are separated out into the three chapters by type: Creational, Structural, and Behavioral. Each chapter begins with an overview of what the patterns of the type can be used for, and how the chapter deals with the patterns as a group. At the end of each chapter there is a discussion section that summarizes the patterns, along with guidance on how to select the right one from the chapter.
Each pattern description contains a number of sections: Intent, Also Known As, Motivation, Applicability, Structure (in OMT), Participants, Collaborations, Consequences, Implementation, Sample Code, Known Uses, and Related Patterns. The breakdown makes it easy to determine if, why, and how you should use the pattern. The authors are justifiably concerned about using the wrong pattern for a given situation. The code snippets are also easy to work through as long as you know an OOP language. C++ is commonly used, with the occasional bit of Smalltalk code.
The three chapters that detail each pattern would be difficult to read right through. However, the opening and closing section of each chapter has valuable information and is worth reading and subsequently referring to some of the patterns discussed. I got the most out of these chapters by picking patterns that might apply to current projects I was working with and then exploring one in depth, branching over into other patterns in a non-linear fashion.
Conclusion
The closing chapter is relatively short, but makes some important points. The authors discuss what to expect from design patterns, some history and other references/influences. Re-factoring is discussed and how patterns will help mitigate this unavoidable process as the software evolves. Other benefits are also brought up briefly. The book closes with an invitation to give the authors feedback and to find patterns that you use. The best designs will use many design patterns that dovetail and intertwine to produce a greater whole.
Book Extras
The whole book has a quality feel to it that is missing from many current texts that cost nearly twice as much. Inside the front cover there is a quick reference to all of the patterns contained in the book with a brief description and page number. The back cover also contains a quick reference for diagram notation and the relationships between the design patters. This is all topped off by two bookmark ribbons attached to the spine.
The Age Issue
Design Patterns was originally published in 1995, and the book mentions that the patterns it contains are little changed from 1992! In the computer field this would be considered an ancient text with how fast software is updated and languages change. Despite this, since the material is not entirely dependent on a particular language or program it holds up quite well. The examples referred to for each pattern are older software that many will not recognize. An updated version would be nice, but being old does not condemn this book to being useless.
Summary
This is an excellent book even if it is beginning to show its age. The fact that it's still very useful is testimony to the quality of the material. A few readers might find the reading to be a bit dry, but the straightforward style was refreshing compared to some other texts. The authors stay focused on the topic and condense it appropriately without going off onto long tangents. Once I've followed through with applying some patterns to projects it might garner an even higher rating. Just from reading about some of the patterns, I could see how they could have applied to previous projects I've worked on, both large and small. The book was certainly a worthwhile investment. If a second version of this book ever comes out, I'd be sure to pick it up as well.
Chapters:
1. Introduction
2. A Case Study: Designing a Document Editor
3. Creational Patterns
4. Structural Patterns
5. Behavioral Patterns
6. Conclusion
Appendix:
A. Glossary
B. Guide to Notation
C. Foundation Classes
You can purchase Design Patterns from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Classic Geek Book (Score:1, Interesting)
Beware of overusing patterns. (Score:5, Interesting)
Sometimes, as if to really horrify me, the reasons for including a pattern are to appease a manager!! This really frightens me, as the patterns are not discussed at the planning stage, but as an afterthought to implementation.
Which brings me to a question. I have always viewed design patterns to be something that are used during the planning phase of a project. All too often, I am seeing where people start trying to shoehorn a design pattern into a project because they just heard about how great of a job it does at something. Does this happen elsewhere, or just with the projects I see?
No pattern experience required (Score:5, Interesting)
Even with no exposure to patterns, I was easily able to understand this book. This book was my first exposure to patterns, and I don't think I could have had a better introduction to the subject. I highly recommend this book to anyone who knows anything about object-oriented design.
Who Actually USES These Patterns? (Score:2, Interesting)
They seem overly complex, and although they try to be general, I can't imagine that they could be easily adapted to any but a few (large) software projects. I don't have enough good examples, but I get the feeling that every major software project will come up with its own "design patterns", and they probably bear little resemblance to the ones in the book (and will be a lot simpler as well). My wife likes them, and she thinks that they provide a common vocabulary for developers to use in developing their own patterns, although I am not convinced.
What has been the experience of /.ers who actually use this book in their (non-educational) software development projects?
ya, I couldn't talk till I saw that book (Score:2, Interesting)
Anyone who does real development was using these patterns years before the book came out.
Books like these are catelogs of other people's ideas and put into a standard format. It is like saying that noone could breath oxygen before the perodic table of the elements came out. Obviously oxygen was around for ever. The patterns in this book are DESCRIPTIONS of other peoples work. It was the method of presenting the ideas that seemed new at the time.
But when it comes right down to it JAVA or C++ classes do a much better job of documenting good design patterns for programming.
The idea of Design Patterns is probably something developed by patent mongerers. They take very simple and trivial ideas and make them seem important by putting them in a common format. Big deal.
You'd be better off reading working code than wasting your time on a five year old book that documents 15 year old ideas.
Re:Since the author didnt mention it... (Score:3, Interesting)
If you like this book, I also recommend trying to find the (free!) whitepapers from Taligent about object-oriented frameworks. They may be hard to find since Taligent is long gone, but I am sure there is a copy on the net somewhere. They did go off on tangents at times, but they are still worth reading. (I believe some of the people who wrote this book were also on Taligent's research team.)
I used both works quite a bit in my undergrad thesis [tripod.com]. Though without this book's inspiration, the thesis would have likely not come to be.
Design Patterns... aren't? (Score:1, Interesting)
Well worth a read, and a thought.
Me, too (Score:4, Interesting)
Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, a.k.a. The Gang of Four, did an excellent job. If you don't buy it, at least pick up a copy at Borders and skim it. You will be a better programmer for it.
Here's another good breakdown of the book [hillside.net]
Re:Next Up in the Obvious Category... (Score:0, Interesting)
This bible was the first English translation of a bible. It is relatively close to the original biblical text (considering some of the other translations I have seen)
But remember from Aramaic->Greek->English is still a long ways off from the original. It is however a good read and IMHO the closest English translation we have.
What I would love to see is a hard core translation with absolutely no politcal or viewpoint wrangling involved. Maybe if we get a machine to do it, but then the programmers would influence it and the output would be the following:
"God is a pink unicorn in the sky who you can't see so don't bother."
pieces,
Maybe Slashdot needs a Book Review Moderation (Score:5, Interesting)
I went to look at other recent slashdot reviews to see what other books design patterns compares to. The results are hilarious:
I think that we should have a way to vote reviews "fair, underrated, or overrated" (and have that change the ranking) because it is clear that books with limited applicability (some only a blip on the technology horizon) often get rated better than truly groundbreaking pieces.
Obligatory Anti-Pattern Viewpoint (Score:4, Interesting)
The "noun model" is mostly via the database in p/r, and is "virtual" rather than a physical code structure. GOF patterns thus look primitive, or "pre-virtual". Database designers in looking for common threads to managing noun models, discovered "pattern formulas" in the form of query languages, especially relational query languages.
OO structures like those found in this book tend to reinvent incremental parts of database techniques from scratch each time. The programmer has to hand weave most of the interrelations and "indexing" between classes. The result is similar to the "network databases" that fell out of favor in the 1960's. The GOF Patterns movement is mostly a rehash of technology and philosophy that died in the early 70's, as variations of Codd's relational model proved superior.
Thus, you are not only reinventing a (halfass) database with GOF, but reinventing an out-of-style one on top of that. A double-whammy no-no in my book.
Dare I say "Disco Patterns"?
If one understands how to use relational databases and technology properly, their need for GOF Patterns greatly diminishes IMO. I know I will take lots of heat for this, but it is what I believe. (Some niches may vary due to special requirements or equipment limitations. But I would note that 1980-era lite-duty DB's ran in like 64K.)
(Is it just me, or is slashdot having network difficulties today? This is the 3rd repost try.)
Design Patterns Aren't (Score:3, Interesting)
Patterns Schmatterns (Score:1, Interesting)
Giving these few basic ideas 20 different names, as does the GOF book, really doesn't add much value. If you get the basic idea (indirection is good) you can invent these and many other 'patterns' at will, and will be a much better developer than someone who has 'learned patterns'.
Beware also that the term patterns implies much more universality than they deliver - use a different/more powerful language and you may find that many of the 'patterns' become unnecessary or irrelevant.
The principles above (loose coupling and indirection are good) are here to stay. If you must read the book, try to focus on the similarities between the patterns.
Most developers would be better served studying a programming language significantly different from the one they use than studying 'patterns'.