The 23 Design Patterns from the Gang of Four
Creational | Structural | Behavioral | |
---|---|---|---|
Class | Factory Method | Adapter (class) | Interpreter Template Method |
Object | Abstract Factory Builder Prototype Singleton | Adapter (object) Bridge Composite Decorator Facade Flyweight Proxy | Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor |
Concepts
Factory—a method or class that produces something:
- A method that creates a GUI
- A class that creates users
- A static method that calls a class constructor in a certain way
Creation Method—a method that creates objects.
- Every factory method is a creation method, but not every creation method is a factory method.
- It is a wrapper around a constructor call. This can prevent the constructor from needing to be changed.
Static Creation Method—a creation method declared static.
Simple Factory Pattern—a class that has one creation method with a large conditional that, based on method parameters, chooses which product class to instantiate and then return.
Factory Method Pattern—a creational design pattern that provides an interface for creating objects but allows subclasses to alter the type of an object that will be created.
Abstract Factory Pattern—a creational design pattern that allows producing families of related (or dependent) objects without specifying their concrete classes.