Design patterns are examples of good design, and the principles and practices that lead to it. They are valuable to learn, because knowing them:
- provides best-practice wisdom that might not otherwise be thought of
- gives a common set of terminology to enhance team communication
- improves the team-wide quality of design and code
In addition, in our Pattern-Oriented Design classes, we show how:
- design patterns lead to a better understanding of object-oriented design principles
- design patterns work together to give designers a better perspective on their own design problems
- design patterns illustrate a better design approach than merely identifying objects and piecing them together.
We find that (if not addressed in class) these compelling benefits are often not realized until a student has learned a lot of different design patterns. Even then, until they also have a lot of experience using design patterns, they might not look for this type of gain. But by focusing on the principles and strategies underlying design patterns, each attendee at our courses begins improving their abilities as a designer immediately.
Ironically, this approach – that of teaching the principles and strategies of design patterns – also makes them much easier to learn.
Let’s look a little deeper at what we mean.
Better understanding of object-oriented design principles
Too many of us have learned that encapsulation is “data hiding”, or that we find our objects by looking at the nouns in our problem domain and make the verbs our methods. These “strategies” may be good starting points (we actually don’t even agree with that) but they definitely result in an overuse of inheritance and systems that are hard to maintain. The reason design patterns are better designs that your normal, run-of-the-mill designs, is that their developers used a different set of guidelines for object selection. Learning these guidelines will improve your designs whether you actually use design patterns or not.
Learning how design patterns can work together
Design patterns as they are often taught, involve one main concept or challenge. In the real world, things typically are much more complicated. In order to use design patterns effectively, it is important to see how patterns can work together to solve real world problems. This is not a problem with design patterns themselves, but rather how they are usually taught. Any course that just discusses design patterns on a one-by-one basis will have minimal impact on your using them in the real world.
A new design approach
We typically think of design as a process of identifying our objects and then “putting them together”. Although common, a better approach is available. This better approach involves viewing things at a higher, more conceptual level, without leading to paralysis by analysis. While many experienced architects already do this, it is a very difficult method to teach. Net Objectives has found that this design approach is much easier to understand once design patterns have been explained.