How to describe a Design Pattern
Name
The pattern's name conveys the essence of the pattern succinctly.
A good name is vital, because it will become part of your design vocabulary.
Intent
A short statement that answers the following questions:
- What does the design pattern do?
- What is its rationale and intent?
- What particular design issue or problem does it address?
Also Known As
Other well-known names for the pattern, if any.
Motivation
A scenario that illustrates a design problem and how the class and object structures in the pattern solve the problem.
The scenario will help you understand the more abstract description of the pattern that follows.
Applicability
- What are the situations in which the design pattern can be applied?
- What are examples of poor designs that the pattern can address?
- How can you recognise these situations?
Structure
A graphical representation of the classes in the pattern using a notation based on the Unified Modeling Language (UML).
We also use interaction diagrams to illustrate sequences of requests and collaborations between objects.
You can use ArgoUML as a free software to create UML class diagrams (http://argouml.tigris.org/\) or give a look at this list https://en.wikipedia.org/wiki/List\_of\_Unified\_Modeling\_Language\_tools
Participants
The classes and/or objects participating in the design pattern and their responsibilities.
Collaborations
How the participants collaborate to carry out their responsibilities.
Consequences (aka Pros and Cons)
- How does the pattern support its objectives?
- What are the trade-offs and results of using the pattern?
- What aspect of system structure does it let you vary independently?
Implementation
- What pitfalls, hints, or techniques should you be aware of when implementing the pattern?
- Are there language-specific issues?
Sample Code
Code fragments that illustrate how you might implement the pattern in JavaScript or Java.
(Make yourself sure to have GitHub repo which hosts real working examples. So list the link to repo here)
Known Uses
Examples of the pattern found in real systems.
We include at least two examples from different domains.
Related Patterns
- What design patterns are closely related to this one?
- What are the important differences?
- With which other patterns should this one be used?