# Design Patterns ## Creation - Builder: hide complexity in object creation - Factory: can produce many types - Prototype: partial or complete object that can be used/cloned - Singleton: only one, cannot be cloned ## Structural - Adapter: adapts interface X to work with Y - Bridge: decoupling class/interface from implementation (frequency changes) - Composite: treat single and composite objects uniformly - Decorator: add behaviour of object without modifying class - Facade: simplified wrapping api surrounding complex code - Flyweight: reduce memory usage by storing data that can be reused externally - Null object: No-op object used to satisfy dependency when no-op desired - Proxy: class which acts as an interface to a resource ## Behavioural - Chain of responsibility: chain of components that each get a chance to act - Command: object representing one instruction - Interpreter: interprets structured text and parses it into symbols/tokens - Iterator: facilitates traversal of data structure - Mediator: allows communication of components that need not be aware of one another - Memento: handle representing state - sometimes used for rollback - Observer: object which is informed of events often through callback function - Strategy: enabling behaviours to be selected at runtime or compile time - Visitor: can traverse inheritance hierarchies