Design Patterns & Resources for Them

Page Table of Contents:

Short Overview of Design Patterns

Patterns are often thought of as “solutions to recurring problems in a context.”  This comes from Christopher Alexander’s Timeless Way of Building, a book I highly recommend.  But at the end of the book, Mr. Alexander says "at this final stage, the patterns are no longer important: the patterns have taught you to be receptive to what is real."  What is real are the forces in your problem, and the patterns provide us ways to look at and resolve these issues.  This is the power of patterns – a way of resolving forces by thinking in terms of recurring issues.  I would suggest patterns are analogous to recipes and the value of patterns is when you understand the issues (taste, texture, cooking affects, …) underneath the recipes.

The Gang of Four book, Design Patterns: Elements of Reusable Object-Oriented Software actually provides these forces, but if one is looking for solutions, they are often overlooked.  The chapters and articles referenced in the Design Patterns Resources section of this page will discuss how patterns teaches us about forces.  He’re I’ll just mention how design patterns provide us with a solid approach to design - one that is often overlooked.  Chapter 1 (Introduction) from this book provides an overview of the lessons learned from Design Patterns:

  • design to interfaces - that is, design to the behavior of the object, not its implementation.
  • find what varies and encapsulate it (essentially, put a layer in, either with an Interface, Abstract class, or even an object that figures out the proper delegation
  • favor delegation over inheritance. In other words, instead of having different ways of doing things by deriving new methods in a class that uses these methods (which leads to a complex inheritance hierarchies), have objects that are hidden behind interfaces and have the using object refer to this interface

Basically, patterns tell us to hide variation in our solutions and do it by encapsulating the implementations that vary behind Interfaces, abstract classes, function pointers, or any way you can think of.  You can quickly see most of the patterns are examples of this by looking at our list of Patterns by Encapsulation on our Design Patterns Repository.  For more, check out these resources.

Design Patterns Resources

Design Patterns Explained: A New Perspective on Object-Oriented Design is the only book we know of that focuses on the thought process of patterns.  That is, instead of just learning patterns, it discusses what is the thinking underneath the patterns, that is, what were the people who wrote the code in the original patterns book thinking when they wrote what are now called design patterns.  Of course, we’re biased, since we wrote the book.

An Introduction to Design Patterns.  This chapter from Design Patterns Explained: A New Perspective on Object-Oriented Design provides a good introduction to design patterns.

For a more recent introduction to patterns, read Can Patterns Be Harmful?  In this article I talk about what patterns are, and are not. 

A couple of webinars on patterns are: Design Patterns Explained and Design Patterns In An Agile Environment.

The Design Patterns Matrix is a summary of all of the 23 patterns in the Gang of Four’s book Design Patterns: Elements of Reusable Object-Oriented Design.  Each pattern has notes on when and how to use it as well as a UML diagram for the pattern. Registration required for these.

Using Patterns in high variability situations. A high variability situation is where there are many variations of relatively few concepts.  A surprising number of applications are of this type.  Most retail applications are of this type. Since design patterns are about encapsulating behavior, they are particularly useful in these situations.  They can allow for dealing with implementations at a conceptual level and having an application architecture that readily handles new variations.  To see examples of how to do this, watch these two videos: Commonality Variability Analysis (book chapter and webinar) and the Analysis Matrix (webinar).

Design Patterns Repository. An on-line collection describing all of the patterns and how they relate to each other.

Essential Skills for the Agile Developer: A Guide to Better Programming and Design. While not really about design patterns (except for one chapter) most of these essential skills were inspired by design patterns.

Other Resources

Core Developer Skills for a path to learn about our approach to better design, programming and testing. Note, this content is part of our portal premium content.

Extended XP Engineering Practices is currently being built, but provides another good overview of what is useful to know.