Design Patterns: Elements of Reusable Object-Oriented Software

Post date: Oct 08, 2011 4:30:19 PM

A new language... for talking about proper designs

In software development, reuse is The Holy Grail. Reusing existing software artifacts is the most cost-effective way to reduce development time and effort. But code snippets and finished software components are not the only artifacts which can be reused. I am sure you already reuse your prior development experience when facing new challenges. This book is just about that. The Gang of Four (GoF) - as the authors are popularly known - try to record experience in object-oriented design to help developers improve their programming skills. As the book preface says...

This book isn't an introduction to object-oriented technology or design. Many books already do a good job of that. This book... describes simple and elegant solutions to specific problems in object-oriented software design. ... Once you understand the design patterns and have had an "Aha!" (and not just a "Huh?") experience with them, you won't ever think about object-oriented design in the same way. Design patterns try to capture common design problems and then they study different solutions and analyze their trade-offs. Their purpose is to document good designs that solve problems you will certainly find in almost any serious software development project.

As other software development best practices, design patterns help us develop more flexible and maintainable software through the use of well-designed interfaces which encapsulate particular implementations. This book proposes a modular approach which encourages the use of object composition and delegation over class inheritance in order to reduce coupling among classes.

The GoF's book is an essential catalog of object-oriented design templates. Each template or pattern can be used as a starting point to develop new object-oriented software, and also in the process of refactoring (i.e. reorganizing and redesigning) existing software systems. Each pattern in this book abstracts key issues of common design structures, is analyzed in depth and is labeled with a short name in order to facilitate communication among developers. Pattern names broaden our technical vocabulary and make easier for us to discuss possible solutions and their trade-offs.

This book discusses each design pattern in self-contained chapters. Each chapter labels the design pattern, presents the problem it intends to solve, describes its solution, and addresses the consequences which could derive from the use of the design pattern in real systems. Some code snippets (in C++ and Smalltalk) illustrate the inner details of each pattern and references to known uses of each pattern are also included, although you will find that you have probably used most patterns in your best projects.

As stated above, patterns are studied separately, although they are organized into three main categories:

    • Creational patterns make a system independent of how its objects are created, composed, and represented (e.g. object factories).

    • Structural patterns present ways to organize objects: how classes and objects are composed to form larger structures (e.g. wrappers, composites, and proxies).

    • Last, but nor least, behavioral patterns are concerned with the assignment of responsibilities among objects (e.g. chains of responsibility, publisher/subscribers, etc.).

The book organization, its quick index, and its diagrammatic roadmaps make it a worthwhile reference to keep at hand on your favorite shelf. This -now famous- book is the flagship publication of a growing community whose interest in well-designed software complements the traditionally academic focus on software development techniques and methodologies. Methodologies teach us how to solve development projects, design patterns show us elegant solutions to those problems.

Once this book is read, and probably re-read, it acts as a real eye-opener. As the authors claim, you will never see your designs in the same way. Design patterns are here to stay. Stay tuned!

P.S.: Many of the design patterns which are described in this book are now part of the mainstream programming culture, so you will probably find many design patterns you are already aware of.

-- Fernando Berzal, Dr. Dobb's Journal ERCB, 2002