Pattern Form
Each pattern is consistent in structure to help maximize its readability. Each is also accompanied by an example that illustrates how the underlying principles it captures are applied. Not all sections appear for all patterns. In some cases, certain sections are omitted when a previous discussion can be referenced. The general structure of each pattern resembles the Gang of Four (GOF) format, which is the format used in the book Design Patterns: Elements of Reusable Object-Oriented Software, structured as follows:
Pattern Name
First, the name of the pattern is presented. The name is important, because it helps establish a common vocabulary among developers.
Pattern Statement
The pattern statement is a summary that describes the pattern. This statement helps establish the intent of the pattern.
Sketch
A sketch is a visual representation that shows the general structure of the pattern. Usually, the Unified Modeling Language (UML) is used here.
Description
The description offers a more detailed explanation of the problem that the pattern solves. The description establishes the motivation behind the pattern.
Implementation Variations
As with any pattern, subtle implementation details quickly arise when applying the pattern to a real-world problem. “Implementation Variations” discusses some of the more significant alternatives you should consider when applying the pattern.
Consequences
All design decisions have advantages and disadvantages, and like most advice on software design, the use of these patterns must be judicious. While they offer a great deal of flexibility, that flexibility comes with a price. The “Consequences” section discusses some of the interesting things you’ll likely encounter when applying the pattern and some of the probable outcomes should you decide to ignore the pattern. After reading through the consequences, you should have a better idea of when you’ll want to apply the pattern and when you may want to consider using an alternative approach. Boiled down, this section represents the advantages and disadvantages of using the pattern, the price you’ll pay, and the benefits you should realize.
Sample
It’s usually easier to understand a pattern when you can see a focused example. In this section, we walk through a sample that illustrates how the pattern can be applied. Sometimes, we work through some code, and other times, some simple visuals clearly convey the message. Most important though is that the sample won’t exist in a vacuum. When we apply patterns in the real world, patterns are often used in conjunction with each other to create a more flexible tailored solution. In cases where it makes sense, the sample builds on previous samples illustrated in other patterns. The result is insight into how you can pragmatically apply the pattern in your work.
Wrapping Up
This section offers a few closing thoughts on the pattern.