定义设计模式
如何定义一个设计模式呢?为何不能定义一个新的设计模式呢?难道就只有 GoF 中所说的 23 种设计模式吗?
Name
All patterns in a catalog start with a name. The name is a vital part of a pattern -- without a good name, a pattern can't become part of the vocabulary that you share with other developers.
Classification
The pattern's classification or category.
Intent
The intent describes what the pattern does in a short statement. You can also think of this as the pattern's definition.
Motivation
The motivation gives you a concrete scenario that describes the problem and how the solution solves the problem.
Applicability
The applicability describes situations in which the pattern can be applied.
Structure
The structure provides a diagram illustrating the relationships among the classes that participate in the pattern.
Participants
The participants are the classes and objects in the design. This section describes their responsibilities and roles in the pattern.
Collaborations
Collaborations tells us how the participants work together in the pattern.
Consequences
The consequences describe the effects that using this pattern may have: good and bad.
Implementation/Sample Code
Implementation provides techniques you need to use when implementing this pattern, and issues you should watch out for.
Sample Code provides code fragments that might help with your implementation.
Know Uses
Know Uses describes examples of this pattern found in real systems.
Related Patterns
Related Patterns describes the relationship between this pattern and others.








评论已关闭