Skip to content
kgleong edited this page Oct 29, 2015 · 17 revisions

Design Patterns

Creational

Structural

  • Adapter
    • Allows translation from one interface to another.
    • Usually an adapter wraps an instance of the adaptee class, allowing the client to use the preferred API, which is adhered to by the adapter.
  • Bridge
    • Decouples the implementation from the interface.
    • Allows for flexible customization when many combinations of interface and implementation subclasses are expected.
    • This pattern allows the implementation and interface to manage their own hierarchy of subclasses.
  • Composite
    • Clients may not need to differentiate between container and component instances.
    • This pattern creates a tree hierarchy of objects and removes the need to account for all possible combinations, greatly increasing flexibility.
  • Decorator/Wrapper
    • Decorators wrap a base component object, adding functionality to the component object.
    • Decorators can be thought of as skins added onto a base component to produce a multitude of different configurations based on the skins that have been attached.
  • Facade
  • Flyweight
  • Proxy

Behavioral

  • Chain of Responsibility
    • Decouples the sender of a request from all potential handlers of the request.
    • This pattern allows multiple handlers to respond to a single request in a specified order.
  • Command
    • Encapsulates a request and any associated actions into an object.
    • Complex transactions can be built by using composite Command objects.
    • This pattern can also support undoable operations.
  • Interpreter
  • Iterator
  • Mediator
    • Establishes a hub that allows objects to interact with each other.
    • Decouples the interacting objects from one another.
  • Momento
    • Encapsulates and records object state. Snapshots of object state can be used to support undoable operations.
    • This design pattern is used when internal object details should not be exposed to external classes.
  • Observer
    • Allows objects to subscribe to other objects.
    • Supports broadcasting of messages or state changes.
    • Decouples objects from their observers.
  • State
    • Encapsulates an object's state into subclasses, making state-specific behavior easy to maintain and read.
    • State transitions can be managed by State subclasses or by the entity itself.
  • Strategy
  • Template Method
  • Visitor

Concurrency

Clone this wiki locally