====== Gang of four ====== ===== Erzeugungsmuster (creational patterns) ===== * Class pattern * [[design_patterns:factorymethod|Factory Method / Virtual Constructor]]: Object creation via method instead of constructor * Object pattern * [[design_patterns:builder|Builder pattern]] * Abstract factory pattern: Group of factories * Prototype pattern: Clone method/interface * Singleton pattern * Multiton pattern (flyweight): Multiple objects based on key (getInstance(key), using a hashmap) ===== Strukturmuster (structural patterns) ===== Class/object composition * Adapter/Wrapper: Adapter realizes interfaces, uses method of external class * Bridge: Hierarchy of abstractions and implementations * Facade: Unified, simplified interface to complex operations involving multiple classes * Decorator: Dynamically add/remove methods to an object * Flyweight: Large number of object required, where information is shared * Composite: Tree-structure to represent part-whole hierarchies (treat part and whole uniformly) * Proxy: Class acting as interface to something else. ===== Verhaltensmuster (behavioral patterns) ===== * Template method: Abstract class which implements invariant code and helper method, while specific implementations are in derived classes * Strategy: Defines interface for a method and concrete implementations. Strategies could be choosen on runtime. * Iterator: Access of elements in container without exposing underlying representation * Interpreter: Using Composite e.g. with Terminal/NonTerminal class representations e.g. to implement an abstract syntax tree