Design Patterns and Principles

Principles:

  1. Strive for loosely coupled designs between objects that interact.


Design Patterns:

Creational Patterns

  1. Factory Method - Define an interface for creating an object, but let the subclasses decide what class to instantiate. Factory Method lets a class defer instantiation to subclasses.
  2. Abstract Factory - Provide an interface for creating families of related or dependent objects without specifying concrete classes.
  3. Builder - Separate the construction of a complex object from its representation so that the same construction process can create different representations.
  4. Prototype - Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
  5. Singleton - Ensure a class only has one instance, and provide a global point of access to it.


Structural Patterns

  1. Adapter - Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
  2. Bridge - Decouple an abstraction from its implementation so that the two can vary independently.
  3. Composite - Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
  4. Decorator - Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
  5. Facade - Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
  6. Flyweight - TODO
  7. Proxy - TODO


Behavioral Patterns:

  1. Chain of Responsibility - TODO
  2. Command - TODO
  3. Iterator - TODO
  4. Mediator - TODO
  5. Memento - TODO
  6. Observer
  7. State - TODO
  8. Strategy - TODO
  9. Template Method - TODO
  10. Visitor - TODO