Design Patterns Flashcards
Creational
Class instantiation or object creation Abstract factory Builder Method Prototype Singleton
Structural
Organizing different classes and objects to form larger structures that provide new functionality Relationship between objects Adapter Bridge Composite Decorator Facade Flyweight Proxy
Abstract factory
Creational pattern
Produce families of related objects without concrete classes
Builder
Creational pattern
build a complex object using simple objects and step by step approach
Method
Creational pattern provides interface for creating objects in a super class but allow subclass to alter type of object created.
Prototype
Clone existing object/clone new instance from prototype
Singletone
Creational pattern Ensure only one instance of the class and provide a global access point to this instance
Adapter
Structural Pattern
Allow objects with different interfaces to collaborate
Bridge
Structural Pattern
Composite
Structural Pattern
Compose objects into tree structure, treat this group of objects similar way to a single object
Decorator
Structural Pattern Add new functionality to objects by wrapping it in a decorator class with the new behaviours
Facade
Structural Pattern
provides a simple interface to hide complexity of existing system
Flyweight
Structural Pattern
Fit more objects into available amount of RAM by sharing common parts of state between multiple objects
Proxy
Structural Pattern
Behaviour Design Pattern
Communication or interaction between objects
Chain Of Responsibility
pass requests along a chain of handlers, each handler decides to process request or pass it to next handler in chain
Command
object used to encapsulate all information needed to perform action or trigger an event at later time
Iterator
aggregate and access elements sequentially without exposing its underlying representation
Interpreter
Language interpreter for a small grammar
Mediator
restricts direct communication between objects/classes instead uses a mediator object
Memento
Restore state of object to previous state
Observer
used in one to many relationships between objects. When one is modified the dependent objects are automatically notified
State
lets an object alter its behaviour when its internal state changes
Strategy
selecting algorithm at runtime depending on context object as oppose to having one algorithm, e.g. diff transport modes in nav app
Template Method
Algorithm with some steps supplied by a derived class
Visitor
operations applied to elements of a heterogeneous object structure