Software Design (CS223 2004F)

Primary Design Patterns

These patterns are taken from:

Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides; Design Patterns; Addison-Wesley; ISBN 0201633612. The book is also available on CD-ROM (ISBN 0201634988).

Numbers in parentheses after patterns names are the page in DP in which the pattern appears.


Abstract Factory (OC) (87)
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Factory Method (CC) (107)
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factor Method lets a class defer instantiation to subclasses.
Prototype (OC) (117)
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Builder (OC) (97)
Separate the constructino of a complex object from its representation so that the same construction process can create different representations.
Singleton (OC) (127)
Ensure a class has only one instance, and provide a global point of access to it.

Structual Patterns

Class Adapter (CS) (139)
Object Adapter (OS) (139)
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
Bridge (OS) (151)
Decouple an abstraction from its implementation so that the two can vary independently.
Composite (OS) (163)
Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Decorator (OS) (175)
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative for extending functionality.
Proxy (OS) (207)
Provide a surrogate of placeholder for another object to control access to it.
Facade (OS) (185)
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
Flyweight (OS) (195)
Use sharing to support large numbers of fine-grained objects efficiently.

Behavioral Patterns

Interpreter (CB) (243)
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Iterator (OB) (257)
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Visitor (OB) (331)
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.
Command (OB) (233)
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Strategy (OB) (315)
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Template Method (CB) (325)
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Memento (OB) (283)
Without violating encapsulation, capture and externalize and object's internal state so that the object can be restored to this state later.
State (OB) (305)
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Chain of Responsibility (OB) (223)
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
Mediator (OB) (273)
Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Observer (OB) (293)
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Wed Dec 8 08:40:13 2004.
The source to the document was last modified on Wed Dec 8 08:40:04 2004.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky,