-
Whatever(any) – type-safe any type container.
| Pattern | Description |
|---|---|
| Chain of responsibility (c++) | used to process varied requests, each of which may be dealt with by a different handler |
| Command (c++) | used to express a request, including the call to be made and all of its required parameters, in a command object |
| Interpreter (c++) | used to evaluate sentences in a language |
| Iterator (c++, swift) | used to provide a standard interface for traversing a collection of items in an aggregate object without the need to understand its underlying structure |
| Mediator (c++) | used to reduce coupling between classes that communicate with each other |
| Memento (c++) | used to capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation |
| Observer (c++) | used to allow an object to publish changes to its state. Other objects subscribe to be immediately notified of any changes |
| State (c++) | used to alter the behaviour of an object as its internal state changes. The pattern allows the class for an object to apparently change at run-time |
| Strategy (c++) | used to create an interchangeable family of algorithms from which the required process is chosen at run-time |
| Template method (c++) | used when two or more implementations of an algorithm exist |
| Visitor (c++) | used to separate a relatively complex set of structured data classes from the functionality that may be performed upon the data that they hold |
| Pattern | Description |
|---|---|
| Abstract factory (c++) | used to provide a client with a set of related or dependant objects. The "family" of objects created by the factory are determined at run-time |
| Builder (c++) | used to create complex objects with constituent parts that must be created in the same order or using a specific algorithm |
| Factory (c++) | used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time |
| Prototype (c++) | used to instantiate a new object by copying all of the properties of an existing object, creating an independent clone |
| Singleton (c++, c++11) | ensures that only one object of a particular class is ever created. All further references to objects of the singleton class refer to the same underlying instance |
| Pattern | Description |
|---|---|
| Adapter (c++) | used to provide a link between two otherwise incompatible types by wrapping the "adaptee" with a class that supports the interface required by the client |
| Bridge (c++) | used to separate the abstract elements of a class from the implementation details, providing the means to replace the implementation details without modifying the abstraction |
| Composite (c++) | used to create hierarchical, recursive tree structures of related objects where any element of the structure may be accessed and utilised in a standard manner |
| Decorator (c++, python) | used to extend or alter the functionality of objects at run- time by wrapping them in an object of a decorator class |
| Facade (c++) | used to define a simplified interface to a more complex subsystem |
| Flyweight (c++) | used to minimize memory usage or computational expenses by sharing as much as possible with other similar objects |
| Proxy (c++) | used to provide a surrogate or placeholder object, which references an underlying object |