Design Patterns: Software, The Gof (Gang of Four: Gamma, Helm, Johnson, Vlissides) Defines Design
Design Patterns: Software, The Gof (Gang of Four: Gamma, Helm, Johnson, Vlissides) Defines Design
CSS 442
3. The solution describes the elements that make up the design, their relationships,
responsibilities, and collaborations. The solution doesn't describe a particular concrete
design or implementation, because a pattern is like a template that can be applied in
many different situations. Instead, the pattern provides an abstract description of a
design problem and how a general arrangement of elements (classes and objects in our
case) solves it.
4. The consequences are the results and trade-offs of applying the pattern. Though
consequences are often unvoiced when we describe design decisions, they are critical
for evaluating design alternatives and for understanding the costs and benefits of
applying the pattern.
The consequences for software often concern space and time trade-offs. They may
address language and implementation issues as well. Since reuse is often a factor in
object-oriented design, the consequences of a pattern include its impact on a system''s
flexibility, extensibility or portability. Listing these consequences explicitly helps you
understand and evaluate them.
Describing Design Patterns (a consistent format from GoF):
Name and Classification -- Must have a meaningful name which conveys the essence of
the pattern succinctly. Classification categorizes it into either creational, structural,
or behavioral design patterns.
Intent -- A statement of the problem which answers the following questions: What does
the design pattern do? What is its rationale and intent? What particular design issue
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 example of poor design that the pattern can address? How can you recognize
these situations?
Structure -- A graphical representation of the classes in the pattern using a notation based
on the Object Modeling Technique (OMT). (UML, based on OMT, is now the
standard notation used.)
3
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 -- 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 and Usage -- Code fragments that illustrate how you might implement the
pattern in C++ or Smalltalk (or Java).
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?
About Patterns:
A good pattern does the following:
It solves a problem: Patterns capture solutions, not just abstract principles or
strategies.
It is a proven concept: Patterns capture solutions with a track record, not theories or
speculation.
The solution isn't obvious: Many problem-solving techniques (such as software
design paradigms or methods) try to derive solutions from first principles. The best
patterns generate a solution to a problem indirectly -- a necessary approach for the
most difficult problems of design.
It describes a relationship: Patterns don't just describe modules, but describe deeper
system structures and mechanisms.
The pattern has a significant human component ... All software serves human
comfort or quality of life; the best patterns explicitly appeal to aesthetics and utility.