Chapter 3. Structuring and Writing Patterns
The success of a new idea depends on its utility and also on how you present it to those it is trying to help. For developers to understand and adopt a design pattern, it should be presented with relevant information about the context, circumstances, prerequisites, and significant examples. This chapter applies to those trying to understand a specific pattern and those trying to introduce a new one because it provides essential information on how patterns are structured and written.
The Structure of a Design Pattern
Pattern authors would be unable to successfully create and publish a pattern if they cannot define its purpose. Similarly, developers will find understanding or implementing a pattern challenging if they do not have a background or context.
Pattern authors must outline a new pattern’s design, implementation, and purpose. Authors initially present a new pattern in the form of a rule that establishes a relationship between:
A system of forces that arises in that context
A configuration that allows these forces to resolve themselves in context
With this in mind, let’s now summarize the component elements for a design pattern. A design pattern should have the following, with the first five elements being the most important:
- Pattern name
A unique name representative of the purpose of the pattern.
A brief description of what the pattern helps achieve.
- Context outline
The contexts in which the ...