Software patterns

Aka how to code and not reinvent the bloody wheel again

Stolen shamelessly from https://sourcemaking.com/design_patterns

Creational

  • Factory = create an object by specifying the type

  • Abstract factory = create an object factory by specifying the type

  • Builder = build a complex object by separating the construction from the representation (construction is outside the class definition) and construction should be like an assembly.

  • Pool = create a pool of objects to reuse, instead of create/destroy cycles

  • Singleton = single instance / manager object

  • Prototype = create object by copying an existing one

Structural

  • Adapter = adapt from 1 interface to another

  • Bridge = separate object abstraction(interface) from implementation, and rely on abstraction ( dependency inversion)

  • Composite

  • Decorator

  • Facade

  • Flyweight

  • Private class data

  • Proxy

Behavioural

  • Chain of responsibility

  • Command

  • Interpreter

  • Mediator

  • Memento

  • Null object

  • Observer

  • State

  • Strategy

  • Template

  • Visitor

Last updated

Was this helpful?