All the C++ source code for the patterns in the book is available in a zip archive.
- Zipped files: Download Zip
Note, this code is stripped directly from the original text and although it all compiles, (well almost all). Our goal was to have syntactically correct code, but not complete or executable code. We have played some tricks with #ifdefs, and introduced some dummy functions, so as to compile the pattern. These do not appear in the book.
Comments to This email address is being protected from spambots. You need JavaScript enabled to view it..
Pattern Name:
Name of pattern goes here
Note: use italics for all references to pattern names per Meszaros' pattern writing patterns. Delete this paragraph from actual pattern.
Aliases: Aliases (or none)
Problem
Give a statement of the problem that this pattern resolves. The problem may be stated as a question.
Context
Describe the context of the problem.
Forces
Describe the forces influencing the problem and solution. This can be represented as a list for clarity.
- Force one
- Force two
Solution
Give a statement of the solution to the problem.
Resulting Context
Describe the context of the solution.
Rationale
Explain the rationale behind the solution.
Known Uses
List or describe places where the pattern is used.
Related Patterns
List or describe any related patterns.
Sketch
Describe the sketch, if needed.
Author(s): Author's name here or "as told to" for pattern mining
Date: Date string goes here, e.g., 3/1/96
This email address is being protected from spambots. You need JavaScript enabled to view it.
Pattern Source: Example: AG Communication Systems, Writers Workshop, etc.
References
Give a list of references cited in the pattern.
Keywords: Give a comma delimited string of terms used for searching.
Example
Give an example implementation of the pattern. This can be code, pseudo code, etc. This section is optional.
This is the The Gang of Four's template. View and save this page's source from your web browser. It includes examples of useful HTML formatting commands.
Pattern Name (Scope, Purpose)
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 recognize these situations?
- An applicable situation
Structure
Participants
The classes and/or objects participating in the design pattern and their responsibilities.
Participant Name
- Responsibility for what
Collaborations
How the participants collaborate to carry out their responsibilities.
- [Collaboration]
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?
- A consequence bullet. Description of consequence
Implementation
What pitfalls, hints, or techniques should you be aware of when implementing the pattern? Are there language-specific issues?
- An implementation Bullet. Description of Bullet
Sample Code and Usage
Code fragments that illustrate how you might implement the pattern in C++ or Smalltalk.
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?
Why are we, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, called this? Who knows. Somehow the name just stuck. Hopefully like, the original Gang of Four, we have started a small cultural change with "Design Patterns..." And hopefully unlike the original Gang of Four we will not meet such an untimely end for our ("counter-revolutionary"?) ideas.
Erich Gamma is currently with a consulting group in Zurich whose name I (Ralph) can't recall. From 1993 to 1995, he was a software engineer at Taligent working on their object-oriented development environment. Erich was previously at UBILAB research laboratory of Union Bank of Switzerland. He was one of the architects of ET++, a portable C++ class library for developing interactive graphical applications. Erich has a Ph.D. in Computer Science from University of Zurich.
Richard Helm recently rejoined IBM to start the Australian branch of the Object Technology Practice. Prior to that, he was a technology consultant with DMR Group, an international information technology consulting firm. There he actively applied design patterns to the design of commercial systems. Prior to DMR, Richard was in the Software Technology department at IBM T.J. Watson Research Center investigating object-oriented design and reuse and visualization. Richard has numerous international publications, writes regularly in Dr. Dobb's Journal, and is a past OOPSLA program committee member. Richard has a Ph.D. in Computer Science from the University of Melbourne, Australia.
Ralph Johnson has been studying object-oriented technology and how it changes the way that software is developed for the past 10 years. He has been involved in the development of an object-oriented operating system (Choices), compiler (Typed Smalltalk), graphics editor framework (HotDraw), music synthesis system (Kyma), and is currently working on a framework for accounting. He is on the faculty of the Department of Computer Science at the University of Illinois and has helped organize several OOPSLA's, including OOPSLA'93 as program chair. He got his PhD from Cornell.
John Vlissides passed away November 24th, 2005. He was a researcher at the IBM T.J. Watson Research Center. His research interests included object-oriented design tools and techniques, application frameworks and builders, and program visualization. Before IBM, John was at the Computer Systems Laboratory at Stanford University. There he co-developed InterViews, a popular object-oriented system for developing graphical applications. John received his Ph.D. in electrical engineering from Stanford University.
- A tool to test private methods and use Design Patterns in Java
-
Tools
for a pattern based development environment.
-
CODE NAVIGATOR FOR C++
A C++ editor which uses patterns to promote code reuse.
-
Pattern
Template Library
Hot new library which provides intrusive data structures and design patterns in the form of easy to use C++ templates. Include a fast, dynamically reconfigurable finite state machine. Includes a free demo, examples, and a full view of the documenation.
-
ModelMaker
Delphi CASE Tool
Supports UML and Patterns. Design Patterns in ModelMaker are implemented as 'ready to use' active agents which insert customable snippets of code. And what's really interesting: an applied pattern stays 'alive' as an active agent looking over your shoulder while you are editing your (code)model and automatically reflects changes where ever needed, keeping the patterns implementation up to date.
-
OmniBuilder
-
You can download,
LGPL, a Pattern Enforcing Compiler (PEC(TM)) for Java(TM) from:
http://pec.dev.java.net/
Advantages:
- The compiler is easy to use, e,g, just add "implements Singleton" to a class definition and the compiler enforces the Singleton pattern.
- The class is automatically documented via Javadoc(TM) that it uses a pattern.
- You can write your own patterns and have them enforced by the compiler.