GoF Patterns Reference


Creational

Abstract Factory
Used to identify an interface for creating families of related or dependent objects without specifying their concrete classes.

Builder
Used to separate the construction of a complex object from its representation so that the same construction process can create different representations.

Factory Method
Used to identify an interface for creating an object, but having the subclasses be responsible for the instantiation of a class.

Prototype
Used to specify the kinds of objects that are to be created using a prototypical instance, and allow new objects to be created by copying this prototype.

Singleton
Used to ensure a class has only one instance, and to provide a global point of access to it.

Structural

Adapter
Used to convert a class interface into another class interface.

Bridge
Used to decouple an abstraction from its implementation so that the two can vary independently.

Composite
Used to compose objects into tree structures for representing part-whole hierarchies.

Decorator
Used to dynamically attach additional responsibilities to an object.  This is an alternative to subclasses.

Facade
Used to dynamically attach additional responsibilities to an object.  This is an alternative to subclasses.

Flyweight
Used to share a large volume of small objects efficiently.

Proxy
Used to provide a surrogate or placeholder for another object to control access to it.

Behavioral

Chain of Responsibility
Used to avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.

Command
Used to encapsulate a request as an object.

Interpreter
Used to define a grammar for simple languages, to represent sentences in that language, and to interpret those sentences.

Iterator
Used to provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

Mediator
Used to 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.

Memento
Used to capture and externalize an objects internal state without violating encapsulation so that the object can be restored to this state later.

Observer
Used to define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

State
Used to allow an object to alter its behavior when its internal state changes so that the object appears to change its class.

Strategy
Used to define a family of algorithms, encapsulate each one, and make them interchangeable.

Template Method
Used to define a skeleton of an algorithm in operation, deferring some steps to subclasses.

Visitor
Used to define a new operation to be performed on the elements of an object structure without changing the classes of the elements.

Reference table text provided by Paul Gustavson

No comments yet... Be the first to leave a reply!

Leave a Reply

Stop censorship