31 December 2006

GoF Patterns

Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

Creational Patterns How to make an object.
Factory Method Makes an instance of several derived classes based on interfaced data or events.
Abstract Factory Creates an instance of several families of classes without detailing concrete classes.
Builder Separates object construction from its representation, always creates the same type of object.
Prototype A fully initialized instance used for copying or cloning.
Singleton A class with only a single instance with global access points.

Structural Patterns The building blocks of objects
Adapter Match interfaces of different classes therefore classes can work together despite incompatible interfaces
Adapter Match interfaces of different classes therefore classes can work together despite incompatible interfaces
Bridge Separates an object's interface from its implementation so the two can vary independently
Composite A structure of simple and composite objects which makes the total object more than just the sum of its parts.
Decorator Dynamically add alternate processing to objects.
Facade A single class that hides the complexity an entire subsystem.
Flyweight A fine-grained instance used for efficient sharing of information contained elsewhere.
Proxy A place holder object representing the true object

Behavioral Patterns the way objects play and work.
Interpreter A way to include language elements in a program to match the grammer of the intended language.
Create the shell of an algorithm in a method, then defer the exact steps to a subclass.
Chain of
A way of passing a request between a chain of objects to find the object that can handle the request.
Command Encapsulate a command request as an object to enable, logging and/or queuing of requests, and provides error-handling for unhandled requests.
Iterator Sequentially access the elements of a collection without knowing the inner workings of the collection.
Mediator Defines simplified communication between classes to prevent a group of classes from referring explicitly to each other.
Memento Capture an object's internal state to be able to restore it later.
Observer A way of notifying change to a number of classes to ensure consistency between the classes.
State Alter an object's behavior when its state changes
Strategy Encapsulates an algorithm inside a class separating the selection from the implementation
Visitor Adds a new operation to a class without changing the class