Thursday, October 22, 2009

GoF Design Patterns

work in progress

Creational Patterns (AbFacBuildFacProSingle)
Abstract Factoryinterface for creating family of related/dependent objects without specifying concrete classes
Builderseparates construction from representation; same construction process can create different objects
Factory Methodinterface for creating an object; lets subclasses decide which class to instantiate
Singletoncontrols access to finite number of instances
Structural Patterns (AdBriComDecFaFlyProx)
Adapterconvert one interface to one the client expects
Bridgefunctional abstraction -> internal implementation
Compositehierarchical tree structures with elements of varying complexity but a uniform interface
Decoratoradd or remove functionality without changing external appearance
Facadeunifying interface on top of a group of interfaces/components of a subsystem
Flyweightsharing/reusing objects
Proxysurrogate controls access to real object
Behavioral Patterns (ChainComIntItMedMemObStateStratTempVis or C2I2M2-OSS-TV)
Chain of Responsibilitymessage handled where it is first received or directed on to another object for handling
Iteratorsequentially access items in a collection that is separate from the underlying collection
Mediatorobject that manages message distribution among other objects
Mementorepresents snapshot of object's state
Observerbroadcast messages to interested listeners
Stateobject alters behavior when internal state changes
Strategygroup of classes that represent a set of possible behaviors
Template Method
Visitorthink of using the enhanced for to iterate over a list in java and perform some operation on that list
underlined patterns are ones I have personally used

No comments: