Design Patterns

TypeDesign PatternDescription
CreationalSingletonEnsures a class has only one instance.
Factory MethodDefines an interface for creating objects but lets subclasses decide the instantiation.
Abstract FactoryProvides an interface for creating families of related objects.
BuilderSeparates object construction from its representation.
PrototypeCreates new objects by copying an existing object.
StructuralAdapterAllows incompatible interfaces to work together.
BridgeDecouples abstraction from implementation.
CompositeOrganizes objects into tree structures.
DecoratorAdds new behaviors to objects dynamically.
FacadeProvides a simplified interface to a complex system.
FlyweightMinimizes memory usage by sharing objects.
ProxyControls access to another object.
BehavioralChain of ResponsibilityPasses a request along a chain of handlers.
CommandEncapsulates a request as an object.
InterpreterDefines a grammar and an interpreter for a language.
IteratorProvides sequential access to elements of a collection.
MediatorCentralizes communication between objects.
MementoCaptures and restores an object’s state.
ObserverNotifies dependent objects of state changes.
StateAllows an object to change behavior when its state changes.
StrategyDefines interchangeable algorithms.
Template MethodDefines the skeleton of an algorithm, allowing steps to be customized.
VisitorAllows adding new operations to objects without modifying them.