5.3 Pattern Notation
Throughout this book design patterns need to be referenced and explained in text and illustrations. A simple notation is used to consistently represent different types of patterns.
Pattern Symbols
As shown in Figure 5.2, specific symbols are used to represent:
- a design pattern
- a compound design pattern
- a group of related design patterns
Additionally, colors are incorporated to indicate if a displayed design pattern is just being referenced and not actually discussed, versus one that is the current topic of discussion.
Pattern Figures
The symbols displayed in Figure 5.2 are used in the following three primary types of diagrams:
- pattern application sequence figures
- pattern relationship figures
- compound pattern hierarchy figures
Let’s take a closer look at each:
Pattern Application Sequence Figures
When documenting design pattern languages, it is helpful to display the suggested sequence in which patterns should be applied. Figures 5.3 and 5.4 show pattern application sequences for groups of related patterns and for individual patterns belonging to a particular group, respectively.
Pattern Relationship Figures
As explained in the upcoming Pattern Profiles section, this book explores numerous inter-pattern relationships and provides one pattern relationship diagram (Figure 5.5) for each documented design pattern.
A style convention applied to all pattern relationship diagrams is the use of color, as follows:
- Each pattern relationship diagram explores the relationships of one pattern. Therefore, that design pattern is highlighted in red, as per the previously established symbol notation.
- Pattern relationships are documented in a unidirectional manner. For relationships where the pattern currently being discussed affects or relates to other patterns, a red line is used along with an arrow pointing to the other pattern. When the relationship line documents how other patterns relate to the current pattern, the lines are green, and the arrows are reversed.
Note that directionality of relationships is preserved in different diagrams. For example, the green relationship line emitting from Service Normalization (131) and pointing to Logic Centralization (136) in the preceding figure would be reversed (and colored red) in the pattern relationship figure for Service Normalization (131).
Compound Pattern Hierarchy Figures
Compound patterns are comprised of combinations of design patterns. When illustrating a compound pattern, a hierarchical representation is usually required, where the compound pattern name is displayed at the top, and the patterns that comprise the compound are shown underneath.
These types of diagrams (Figures 5.6 and 5.7) can be considered simplified relationship figures in that they only identify which patterns belong to which compound, without getting into the details of how these patterns relate. Compound patterns are documented separately in Chapter 22, but compound hierarchy figures are displayed throughout the upcoming chapters.
Capitalization
All design pattern names (including names of compound patterns) are capitalized throughout this book. The names for groups of related patterns are capitalized when displayed in Figures but not when referenced in body text.
Page Number References
As you may have already noticed in earlier parts of this chapter, each pattern name is followed by a page number in parentheses. This number, which points to the first page of the corresponding pattern profile, is provided for quick reference purposes. Its use has become a common convention among pattern catalogs. The only time the number is not displayed is when a pattern name is referenced within that pattern’s profile section.