Design Patterns Explained A New Perspective on Object Oriented Design 2nd Edition Date: 19 January 2011, 08:15
|
Preface Should You Buy the Second Edition If You Already Own the First? The answer, of course, is yes! Here s why. Since the first edition was written, we have learned so much more about design patterns, including the following: How to use commonality and variability analysis to design application architectures How design patterns relate to and actually facilitate eXtreme programming (XP) and agile development. How testing is a first principle of quality coding. Why the use of factories to instantiate and manage objects is critical Which set of patterns are essential for students to help them learn how to think in patterns This book covers all of these topics. We have deepened and clarified what we had before and have added some new content that you will find very helpful, including the following: Chapter 15: Commonality and Variability Analysis Chapter 20: Lessons from Design Patterns: Factories Chapter 21: The Object-Pool Pattern (a pattern not covered by the Gang of Four) Chapter 22: Factories Summarized We have changed the order in which we present some of the patterns. This sequence is more helpful for the students in our courses as they learn the ideas behind patterns. We have touched every chapter, incorporating the feedback we have received from our many readers over these past three years. And, to help students, we have created study questions for each chapter (with answers on the book s companion Web site). We can honestly say this is one of the few second editions that is definitely worth buying even if you have the first one. We would love to hear what you think. Alan and Jim Design patterns and object-oriented programming. They hold such promise to make your life as a software designer and developer easier. Their terminology is bandied about every day in the technical and even the popular press. It can be hard to learn them, however, to become proficient with them, to understand what is really going on. Perhaps you have been using an object-oriented or object-based language for years. Have you learned that the true power of objects is not inheritance, but is in "encapsulating behaviors"? Perhaps you are curious about design patterns and have found the literature a bit too esoteric and high-falutin. If so, this book is for you. It is based on years of teaching this material to software developers, both experienced and new to object orientation. It is based upon the belief and our experience that when you understand the basic principles and motivations that underlie these concepts, why they are doing what they do, your learning curve will be incredibly shorter. And in our discussion of design patterns, you will understand the true mindset of object orientation, which is a necessity before you can become proficient. As you read this book, you will gain a solid understanding of 12 core design patterns and a pattern used in analysis. You will learn that design patterns do not exist in isolation, but work in concert with other design patterns to help you create more robust applications. You will gain enough of a foundation that you will be able to read the design pattern literature, if you want to, and possibly discover patterns on your own. Most importantly, you will be better equipped to create flexible and complete software that is easier to maintain. Although the 12 patterns we teach here are not all of the patterns you should learn, an understanding of these will enable you to learn the others on your own more easily. Instead of giving you more patterns than you need to get started, we have included pattern-related issues that will be more useful. From Object Orientation to Patterns to True Object Orientation In many ways, this book is a retelling of my personal experience learning design patterns. This started with learning the patterns themselves and then learning the principles behind them. I expanded this understanding into the realms of analysis and testing as well as learning how patterns relate to agile coding methods. This second edition of this book includes many additional insights I have had since publication of the first edition. 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 most experts advised. It wasn t until I began to learn design patterns that my object-oriented design abilities expanded and deepened. Knowing design patterns has made me a better designer, even when I don t use these patterns directly. I began studying design patterns in 1996. I was a C++/object-oriented design 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 coauthor, 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. And second, I discovered that I was not taking full advantage of designing to interfaces and that I didn t always concern myself with seeing whether I could have an object use another object without knowing the used object s type. I also noticed that beginners in 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 to mature their designs more quickly. By the end of the study sessions, I was convinced that design patterns were the greatest thing to happen to software design since the invention of object-oriented design. When I looked at my work at the time, however, I saw that I was not incorporating any design patterns into my code. Or, at least, not consciously. Later, after learning patterns, I realized I had incorporated many design patterns into my code just out of being a good coder. However, now that I understand patterns better, I am able to use them better. I just figured I didn t know enough design patterns yet and needed to learn more. At the time, I only knew about six of them. Then I had an epiphany. I was working as a mentor in object-oriented design for a project and was asked to create the project s high-level design. The leader of the project was extremely sharp, but 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 two minutes of looking at the problem, I had developed a design based on my normal approach of data abstraction. Unfortunately, it was also clear to me 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 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-oriented design 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 should 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 (Oxford University Press, 1979). 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 just using them to create 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 that Alexander calls a particularly bad idea. I had never asked whether I had the right classes because they just seemed so right, so obvious; they were the classes that 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. It was then that I started incorporating design patterns into my development work and 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 whom I was teaching. Imagine my surprise! The design pattern books I had been reading and the design p...
|
DISCLAIMER:
This site does not store Design Patterns Explained A New Perspective on Object Oriented Design 2nd Edition on its server. We only index and link to Design Patterns Explained A New Perspective on Object Oriented Design 2nd Edition provided by other sites. Please contact the content providers to delete Design Patterns Explained A New Perspective on Object Oriented Design 2nd Edition if any and email us, we'll remove relevant links or contents immediately.
|
|
|