Design Patterns Explained: A New Perspective on Object-Oriented Design Paperback – Jul 9 2001
There is a newer edition of this item:
Customers Who Bought This Item Also Bought
No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.
To get the free app, enter your e-mail address or mobile phone number.
From the Inside Flap
From Object Oriented to Patterns to True Object Oriented
In many ways, this book is a retelling of my personal experience learning design patterns. Prior to studying design patterns, I considered myself to be reasonably expert in object-oriented analysis and design. My track record had included several fairly impressive designs and implementations in many industries. I knew C++ and was beginning to learn Java. The objects in my code were well-formed and tightly encapsulated. I could design excellent data abstractions for inheritance hierarchies. I thought I knew object-orientation.
Now, looking back, I see that I really did not understand the full capabilities of object-oriented design, even though I was doing things the way the experts said should be done. It wasn't until I began to learn design patterns that my object-oriented abilities expanded and deepened. Knowing design patterns has made me a better designer, even when I don't use design patterns directly.
I began studying design patterns in 1996. I was a C++ / object-oriented mentor at a large aerospace company in the northwest. Several people asked me to lead a design pattern study group. That's where I met my co-author, Jim Trott. In the study group, several interesting things happened. First, I grew fascinated with design patterns. I loved being able to compare my designs with the designs of others who had more experience than I had. I discovered that I was not taking full advantage of designing to interfaces and that I didn't always concern myself with seeing if I could have an object use another object without knowing the used object's type. I realized that beginners to object-oriented design, those who would normally be deemed as learning design patterns too early, were benefiting as much from the study group as the experts were. The patterns presented examples of excellent object-oriented designs and illustrated basic object-oriented principles, which helped them to mature my designs more quickly. By the end of the study club, I was convinced that design patterns were the greatest thing to happen to software design since the invention of object-oriented design.
However, when I looked at my work at the time, I saw that I was not incorporating any design patterns into my code.
I just figured I didn't know enough design patterns yet and needed to learn more. At the time, I only knew about 6 of them. Then I had what could be called an epiphany. I was working on a project as a mentor in object-oriented design. I was asked to create a high-level design for the project. The leader of the project was extremely sharp, but at the time was fairly new to object-oriented design.
The problem itself wasn't that difficult, but it required a great deal of attention to make sure the code was going to be easy to maintain. Literally, after about 2 minutes of looking at the problem, I had developed a design based on my normal approach of data-abstraction. Unfortunately, it was very clear this was not going to be a good design. Data-abstraction alone had failed me. I had to find something better.
Two hours later, after applying every design technique that I knew, I was no better off. My design was essentially the same. What was most frustrating was that I knew there was a better design. I just couldn't see it. Ironically, I also knew of four design patterns that "lived" in my problem but I couldn't see how to use them. Here I was--a supposed expert in object-orientation - baffled by a simple problem!
Feeling very frustrated, I took a break and started walking down the hall to clear my head, telling myself I would not think of the problem for at least 10 minutes. Well, 30 seconds later, I was thinking about it again! But I had gotten an insight that changed my view of design patterns: rather than using patterns as individual items, I was supposed to use the design patterns together.
Patterns are supposed to be sewn together to solve a problem.
I had heard this before, but hadn't really understood it. Because patterns in software have been introduced as design patterns, I had always labored under the assumption that they had mostly to do with design. My thoughts were that in the design world, the patterns came as pretty much well-formed relationships between classes. Then, I read Christopher Alexander's amazing book, The Timeless Way of Building. I learned that patterns existed at all levels - analysis, design and implementation. Alexander discusses using patterns to help in the understanding of the problem domain (even in describing it), not in creating the design after the problem domain is understood.
My mistake had been in trying to create the classes in my problem domain and then stitch them together to make a final system, a process which Alexander calls a particularly bad idea. I had never asked if I had the right classes because they just seemed so right, so obvious: they were the classes that I immediately came to mind as I started my analysis, the "nouns" in the description of the system that we had been taught to look for. But I had struggled trying to piece them together.
When I stepped back and used design patterns and Alexander's approach to guide me in the creation of my classes, a far superior solution unfolded in only a matter of minutes. It was a good design and we put it into production. I was excited: excited to have designed a good solution and excited about the power of design patterns. I was convinced and started incorporating them into my development work and in my teaching.
I began to discover that programmers who were new to object-oriented design could learn design patterns and in doing so, develop a basic set of object-oriented design skills. It was true for me and it was true for the students that I was teaching.
Imagine my surprise! The design pattern books I had been reading and the design pattern experts I had been talking to were saying that you really needed to have a good grounding in object-oriented design before embarking on a study of design patterns. Nevertheless, I saw, with my own eyes, that students who learned object-oriented design concurrently with design patterns learned object-oriented faster than those just studying object-oriented design. They even seemed to learn design patterns at almost the same rate as experience object-oriented practitioners.
I began to use design patterns as a basis for my teaching. I began to call my classes "Pattern Oriented Design: Design Patterns from Analysis to Implementation."
I wanted my students to understand these patterns and began to discover that using an exploratory approach was the best way to foster this understanding. For instance, I found that it was better to present the Bridge pattern by presenting a problem and then have my students try to design a solution to the problem using a few guiding principles and strategies that I had found were present in most of the patterns. In their exploration, the students discovered the solution--called the Bridge pattern--and remembered it.
A slight digression. The guiding principles and strategies seem very clear to me now. Certainly, they are stated in the "Gang of Four's" design patterns book. But I it took me a long time to understand them because of limitations in my own understanding of the object-oriented paradigm.. It was only after integrating in my own mind the work of the Gang of Four with Alexander's work, Jim Coplien's work on commonality and variability analysis and Martin Fowler's work in methodologies and analysis patterns that these principles became clear enough to me to that I was able talk about them to others. It helped that I was making my livelihood explaining things to others so I couldn't make assumptions as easily as I could when I was just doing things for myself.
In any event, I found that these guiding principles and strategies could be used to "derive" several of the design patterns. By "derive a design pattern," I mean that if I looked at a problem that I knew could be solved by a design pattern, I could use the guiding principles and strategies to come up with the solution that is expressed in the pattern. I made it clear to my students that we weren't really coming up with design patterns this way. Instead, I was just illustrating one possible thought process that the people who came up with the original solutions, those that were eventually classified as design patterns, may have used.
My abilities to explain these few, but powerful, principles and strategies improved. As they did, I found that they became more useful to explain an increasing number of the Gang of Four patterns. In fact, I use these principles and strategies to explain 12 of the 14 patterns I discuss in my design patterns course.
I found that I was using these principles in my own designs both with and without patterns. This didn't surprise me. If using these strategies resulted in a design equivalent to a design pattern when I knew the pattern was present, that meant they were giving me a way to derive excellent designs (since patterns are excellent designs by definition). Why would I get any poorer designs from these techniques just because I didn't know the name of the pattern that may or may not be present anyway?
These insights helped hone my training process (and now my writing process). I had already been teaching my courses on several levels. I was teaching the fundamentals of object-oriented analysis and design. I did that by teaching design patterns and using them to illustrate good examples of object-oriented analysis and design. In addition, by using the patterns to teach the concepts of object-orientation, my students were also better able to understand the principles of object-orientation. And by teaching the guiding principles and strategies, I was able to equip them to understand and discover patterns for themselves. This high view of concepts and low view of principles and strategies proved extremely effective.
I relate this story because this book follows much the same pattern as my course (pun intended). In fact, from Chapter 3 on, this book is very much a first day of my two-day course: Pattern Oriented Design: Design Patterns From Analysis to Implementation.
As you read this book, you will learn the patterns. But even more importantly, you will learn why they work and how they can work together and the principles and strategies upon which they rely. It will be useful to draw on your own experiences. When I present a problem in the text, it is helpful if you imagine a similar problem that you have come across. This book isn't about new bits of information or new patterns to apply, but rather a new way of looking at object-oriented software development. I hope that your own experiences, connected with the principles of design patterns, will prove to be a powerful ally in your learning. --Alan Shalloway December, 2000 From Artificial Intelligence to Patterns to True Object Oriented
My journey to design patterns had a different starting point than Alan's but we have reached the same conclusions:
Pattern-based analysis makes you a more effective and efficient analyst because they let you deal with your models more abstractly and because they represent the collected experiences of many other analysts. Patterns help people to learn principles of object-orientation. The patterns help to explain why we do what we do with objects.
I started my career in artificial intelligence (AI) creating rule-based expert systems. This involves listening to experts and creating models of their decision-making processes and then coding these models in rules in a knowledge-based system. As I built these systems, I began to see repeating themes: in common types of problems, experts tended to work in similar ways. For example, experts who are diagnosing problems with equipment tend to look for simple, quick fixes first, then they get more systematic, breaking the problem into component parts; but in their systematic diagnosis, they tend to try first inexpensive tests or tests that will eliminate broad classes of problems before other kinds of tests. This was true whether we were diagnosing problems in a computer or a piece of oil-field equipment.
Today, I would call these recurring themes "patterns." Intuitively, I began to look for these recurring themes as I was designing new expert systems. My mind was open and friendly to the idea of patterns, even though I did not know what they were.
Then, in 1994, I discovered that researchers in Europe had codified these patterns of expert behavior and put them into a package that they called Knowledge Analysis and Design Support, or "KADS." Dr. Karen Gardner, a most gifted analyst, modeler, mentor, and human being, began to apply KADS to her work in the United States. She extended the Europeans' work to apply KADS to object-oriented systems. She opened my eyes to an entire world of pattern-based analysis and design that was forming in the software world, in large part due to Christopher Alexander's work. Her book, Cognitive Patterns (Cambridge University Press, 1998) describes this work.
Suddenly, I had a structure for modeling expert behaviors without getting trapped by the complexities and exceptions too early. I was able to complete my next three projects in less time, with less rework, and with greater satisfaction by end-users, because:
I could design models more quickly because the patterns predicted for me what ought to be there. They told me what the essential objects were, what to pay special attention to. I was able to communicate much more effectively with experts because we had way to deal with the details and exceptions in a more structured way. The patterns allowed me to develop better end-user training for my system because the patterns predicted the most important features of the system.
The last point is significant. Patterns help end users understand systems because they provide the context for the system, why we are doing things in a certain way. We can use patterns to describe the guiding principles and strategies of the system. And we can use patterns to develop the best examples to use to help them understand the system.
I was hooked.
So, when a design patterns study group started at my place of employment, I was eager to go. This is where I met Alan who had reached a similar point in his work as an object-oriented designer and mentor. The result is this book.
I hope that the principles in this book help you in your own journey to become a more effective and efficient analyst. --James Trott December, 2000
From the Back Cover
"...I would expect that readers with a basic understanding of object-oriented programming and design would find this book useful, before approaching design patterns completely. Design Patterns Explained complements the existing design patterns texts and may perform a very useful role, fitting between introductory texts such as UML Distilled and the more advanced patterns books."
Design Patterns Explained: A New Perspective on Object-Oriented Design draws together the principles of object-oriented programming with the power of design patterns to create an environment for robust and reliable software development. Packed with practical and applicable examples, this book teaches you to solve common programming problems with patterns--and explains the advantages of patterns for modern software design.
Beginning with a complete overview of the fundamentals of patterns, Design Patterns Explained stresses the importance of analysis and design. The authors clearly demonstrate how patterns can facilitate the overall development process. Throughout the book, key object-oriented design principles are explained, along with the concepts and benefits behind specific patterns. With illustrative examples in C++ and Java, the book demystifies the "whys," "why nots," and "hows" of patterns and explains pattern implementation.
Key topics covered include:
- New perspectives on objects, encapsulation, and inheritance
- The idea of design patterns, their origins, and how they apply in the discipline of software design
- Pattern-based, object-oriented software development using the Unified Modeling Language (UML)
- How to implement critical patterns--Strategy, Observer, Bridge, Decorator, and many more
- Commonality/Variability Analysis and design patterns, and how they aid in understanding abstract classes
From analysis to implementation, Design Patterns Explained allows you to unleash the true potential of patterns and paves the path for improving your overall designs. This book provides newcomers with a genuinely accurate and helpful introduction to object-oriented design patterns.
0201715945B06142001 See all Product Description
Top Customer Reviews
Context: You have been reading books on design patterns and you understand what your was reading. However, you are not sure where or how to apply the patterns. You are just was not having the ahuh moment when it comes to patterns.
Forces: You are trying various ways to use these very important patterns in your day to day work. However, you feel like a high school kids trying to learn Einstein's notes.
Solution: Buy and read this book so you can have the foundation to understand how to think about patterns.
Consequences: As a result of reading this book
* You will have the required ahuh moment where everything start making sense.
* You will start looking at other design patterns and understanding what they are, and what they are achieving.
* This book is not a catalog of patterns; instead of feeding you a list of patterns it helps you understand all the patterns in all the other books. Think of the motto "Give a man a fish, feed him for a day. Teach a man to fish, feed for life." In this case he is teaching you to understand patterns.
Personal Note: I have read some patterns several times and it never really clicked. The other day I was reading about DAO and I caught myself saying this is just like an adapter pattern. That is a sign the writers of this book did a very good job.
First, the benefits. Lots of beginners like the informal and case-oriented approach the authors take. This reads a lot less like someone's PhD dissertation, and shows Java and C++ samples to explain many patterns and concepts. (For some, translating a Smalltalk or even C++ example into Java is difficult enough for the real topic of discussion to get lost.)
It also uses the sustained example of a CAD/CAM system to show specific, concrete cases where a pattern might apply. This prolonged example means the reader doesn't have to switch gears to a new application context every time a pattern is put to work, and gives a chance for interactions between multiple patterns to emerge.
As near as I can tell, this book came from the class notes of a course taught by one of the authors. That explains the many additional hints about good programming and tips on OO style. It also explains the idiosyncratic order in which topics appear - although it stays close to the content of Gamma et al., it certainly does not stay close to that book's organization.
That's where I think Shalloway and Trott start to falter. The organization of this book seems to be built around the CAD/CAM example, not around any inherent properties of the patterns or logical connection to OO topics. That's fine, until you go to an application different from theirs. The focus on specific examples is also a weakness. Design Patterns are too broad to be defined by any one implementation. That means that any example, while it represents one way to apply a pattern, fails to represent a half-dozen others.Read more ›
The authors also share some very interesting insights on object orientation, product of their own empirical experience in the real world, giving the foundations to their discussion.
Unfortunately, the authors do not go into the 23 GoF patterns, altough they explain Bridge, Adapter, Facade, Abstract Factory, Singleton, Strategy, Decorator, Observer, Template Method and Factory Method.
I would like to say a constructive word about two of the samples: in the Abstract Factory, they depart from a quite simple point to finally get to a more complex solution (the abstract factory itself) without much added value (is like the "Patter Happiness" concept presented in the book Refactoring to Patterns). Something similar happened to me on the Decorator sample.
Anyway, I think this book is an excellent buy. It is very well written, very enjoyable and very easy to read. Personally, I liked this book very much and I would recommend it as a companion of the GoF book to anyone who wants to get initiated in the patterns field .
I was just going through the final chapter that recommends some further readings. On page 317, the authors claims that Stevens' book, Advanced Programming in the UNIX Environment, "is a must resource for anyone doing C++ development on UNIX." Either they have faulty memory or they never read the book themselves, because the Stevens book contains only C code and by no means designed as OO. Granted that C code is also C++ code, but that certainly misses the point of what this book is centered around: object-oriented design patterns.
Sorry I got a little carried away in commenting on this particular book, but sometimes it's fun to laugh at the professors or instructors on the podium at little.
Most recent customer reviews
I was unable to penetrate Gamma et al before reading this book and was able to make use of Gamma et al after reading the book. Read morePublished on June 1 2004 by Michael Tobis
As .NET is becoming more and more popular, alot of coders are going from classical VB to a Object-Oriented framework. Read morePublished on May 10 2004 by David Baron
Unlike most other, indeed more advanced, books on the topic, this one is written with an informal voice. Read morePublished on Feb. 6 2004 by Foti Massimo
I picked up this book after reading through the original Design Patterns (GoF). Although they discuss similar topics and this book refers to the GoF book quite frequently, I... Read morePublished on Jan. 13 2004
Having used design patterns since their discovery in the early 90's, I am a seasoned advocate. This book's informal voice deals with patterns in an easy-to-follow, almost jovial... Read morePublished on Oct. 28 2003 by Sean Dwyer
I agree with most of the reviewers that go soft on this book. Its not that earth shatteritng, and "accessible" is probably a good word. Read morePublished on Aug. 28 2003 by C. Roeder
Excellent book for those who are new to design patterns and want to learn about them. It's also very helpful even if you don't master OO design. Read morePublished on July 8 2003 by RH
Look for similar items by category
- Books > Computers & Technology > Computer Science > Software Engineering > Design Tools & Techniques
- Books > Computers & Technology > Computer Science > Software Engineering > Methodology
- Books > Computers & Technology > Operating Systems
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Object-Oriented Design
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Software Development
- Books > Computers & Technology > Software
- Books > Textbooks > Computer Science & Information Systems > Object-Oriented Software Design
- Books > Textbooks > Computer Science & Information Systems > Operating Systems