Design Patterns: Glenn D. Blank
Design Patterns: Glenn D. Blank
Glenn D. Blank
Definitions
Patterns in engineering
Pattern
Command pattern
Structure:
Observer pattern
Intent:
Creational patterns:
Structural patterns:
Behavioral patterns:
Ensure that a class has only one instance and provide a global point
of access to it
class Singleton
{ public:
static Singleton* getInstance();
protected: //Why are the following protected?
Singleton();
Singleton(const Singleton&);
Singleton& operator= (const Singleton&);
private: static Singleton* instance;
};
Creational Patterns
Abstract Factory:
Factory for building related objects
Builder:
Factory for building complex objects incrementally
Factory Method:
Method in a derived class creates associates
Prototype:
Factory for cloning new instances from a prototype
Singleton:
Factory for a singular (sole) instance
Structural patterns
Example: Proxy
Structural Patterns
Adapter:
Translator adapts a server interface for a client
Bridge:
Abstraction for binding one of many implementations
Composite:
Structure for building recursive aggregations
Decorator:
Decorator extends an object transparently
Facade:
Simplifies the interface for a subsystem
Flyweight:
Many fine-grained objects shared efficiently.
Proxy:
One object approximates another
Behavioral Patterns
Chain of Responsibility:
Request delegated to the responsible service provider
Command:
Request or Action is first-class object, hence re-storable
Iterator:
Aggregate and access elements sequentially
Interpreter:
Language interpreter for a small grammar
Mediator:
Coordinates interactions between its associates
Memento:
Snapshot captures and restores object states privately
Observer:
Dependents update automatically when subject changes
State:
Object whose behavior depends on its state
Strategy:
Abstraction for selecting one of many algorithms
Template Method:
Algorithm with some steps supplied by a derived class
Visitor:
Operations applied to elements of a heterogeneous object
structure
Design patterns
structure and
behavior accessible for adaptation and change:
Meta-level provides self-representation, base level
defines the application logic
Reflection makes classes self-aware, their
Web Resources
http://home.earthlink.net/~huston2/dp/
http://www.dofactory.com/
http://hillside.net/patterns/