Design Patterns

TOPICS ON THIS PAGE

What Are Design Patterns? (the short answer)
What Are Design Patterns? (the long answer: Chapter 5 from our book: Design Patterns Explained: A New Perspective on Object-Oriented Design)
Why Study Patterns?
Should Learning Design Patterns be Hard?
Are Study Groups Really the Best Way To Learn Patterns?
If Not, What is?
If Your Attitude Is "Patterns, So What?", Read This

What Are Design Patterns?

"A pattern is a solution to a problem in a context"

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice."

-- Christopher Alexander - A Pattern Language

Patterns are not new, talking about them is.

Read excerpts from our book: Design Patterns Explained: A New Perspective on Object-Oriented Design that describes what design patterns are.

Why study patterns?

There are three main reasons to study design patterns:

Learn already existing quality solutions.
During the lifecycle of a project, many of the problems faced will be fairly common problems. By being able to recognize these patterns you can take advantage of solutions that have been used by other software developers. Because many patterns are very well described now, you can take advantage of what other developers have already faced, including knowledge of consequences that may not be immediately apparent.
Learn existing terminology
Specialized terminology is all around us -- except perhaps in the area of design. If you are a basketball fan, you know what it means when someone says 'give and go'. For sailors, 'prepare to jibe' indicates a whole series of actions is about to take place. If you overhear carpenters talking about 'dove-tail joints' or 'tongue-and-groove' joints, you may not know what it means but you know it means something to them. The point is, terminology, or jargon, if you will, has the advantage being able to describe a solution or a situation with very few words -- but only if both people know what those words mean.
Learn to think in patterns
Patterns aren't intended just to be used individually. Patterns are really meant to be combined together. A pattern language, consisting of several patterns, describes how the patterns work together. Once one learns enough patterns, it is possible to raise one's conceptual view of her problem from working with classes and objects to working with the patterns into which these fall. This allows one to perform design from a different view. To paraphrase Christopher Alexander:
patterns are used as operators which differentiates space: creating distinctions where no distinction was before.
In other words, they allow us to begin our design at a conceptual view and work down. The patterns we use define the architecture and relationship of the classes involved for us.
Expand on your object-oriented skills
To quote Martin Fowler's UML Distilled. Applying the Standard Object Modeling Language:
"The concept of patterns has become vital to learning OO because using patterns gets you to concentrate on good OO designs and to learn by following an example. Once you have gotten the hang of some basic modeling techniques, such as simple class diagrams and interaction diagrams, it is time to start looking at patterns."

Should Learning Design Patterns Be Hard?

We do not believe it should be hard to learn about design patterns. Unfortunately, there are not many people who have both used them and are capable of teaching others how to use them.

Are Study Groups Really the Best Way To Learn Patterns?

We do not believe the conventional wisdom that study groups are the most effective way to learn about design patterns. We think that belief has come about because of the difficulty people have had in learning patterns and there is often no other alternative. While we do believe that study groups are valuable, they have two intrinsic challenges.

First, if no one in the group understands design patterns when they first get together, it is difficult to have the group ‘bootstrap’ itself into learning them. Sure, people can use the Gang of Four’s brilliant book on Design Patterns: Design Patterns: Elements of Reusable Object-Oriented Software. However, that book was not written for this purpose (i.e., teaching newbies design patterns in a study group format). It does not take long to find many people who have looked into patterns and come away with as much frustration as knowledge.

The second challenge is that the real power of design patterns is not in the patterns themselves. It is in using them as conceptual building blocks, as a way to build architectures, as Alan calls it - a way to think in patterns. Arriving at this level is most likely going to be achieved only by working on real projects after a certain number of patterns have been learned.

If Not, What Is?

We believe that the best way to learn design patterns is to be coached by by someone who has used them while your team works on a real project. In this way, when they will be useful, your coach can see that, and help your team use them.

If Your Attitude Is "Patterns, So What?", Read This

Many people have studied design patterns, learned a few, and said something like, "OK, that’s interesting, but so what?" While we believe that design patterns are useful individually, we think their real use is that they can be used to elevate our level of conceptual thinking. This allows for us to design our architectures with built in flexibility and robustness. Alan’s methodology of Thinking in Patterns allows developers to use design patterns to build application architectures that may otherwise be difficult to create. If you are ready to learn more about this, check out our course by the same name "Design Patterns Explained", and a related Design Patterns for Agile Developers course.