Friday, March 28, 2014

GoF Design Patterns - Quick Overview

GoF Creational Patterns
Abstract FactorySets of methods to make various objects.
BuilderMake and return one object various ways.
Factory MethodMethods to make and return components of one object various ways.
PrototypeMake new objects by cloning the objects which you set as prototypes.
SingletonA class distributes the only instance of itself.

GoF Structural Patterns
AdapterA class extends another class, takes in an object, and makes the taken object behave like the extended class.
BridgeAn abstraction and implementation are in different class hierarchies.
CompositeAssemble groups of objects with the same signature.
DecoratorOne class takes in another class, both of which extend the same abstract class, and adds functionality.
FacadeOne class has a method that performs a complex process calling several other classes.
FlyweightThe reusable and variable parts of a class are broken into two classes to save resources.
ProxyOne class controls the creation of and access to objects in another class.
GoF Behavorial Patterns
Chain Of ResponsibilityA method called in one class can move up a hierarchy to find an object that can properly execute the method.
CommandAn object encapsulates everything needed to execute a method in another object.
InterpreterDefine a macro language and syntax, parsing input into objects which perform the correct opertaions.
IteratorOne object can traverse the elements of another object.
MediatorAn object distributes communication between two or more objects.
MementoOne object stores another objects state.
ObserverAn object notifies other object(s) if it changes.
StateAn object appears to change its` class when the class it passes calls through to switches itself for a related class.
StrategyAn object controls which of a family of methods is called. Each method is in its` own class that extends a common base class.
TemplateAn abstract class defines various methods, and has one non-overridden method which calls the various methods.
VisitorOne or more related classes have the same method, which calls a method specific for themselves in another class.

No comments: