This repository implements all of the design patterns of Gang of Four (GoF). Below you can see all of the design patterns:
- Creational: Abstract Factory, Builder, Factory Method, Prototype e Singleton.
- Structural: Adapter, Bridge, Composite, Decorator, Façade, Flyweight e Proxy.
- Behavioural: Chain of responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template method e Visitor.
Creational is used to abstract the process of how an object is created in the application.
Structural is used in class composition and object composition.
Behavioural category on how classes and objects interact and distribute responsibilities in the application.
- Singleton: Ensure that a class has only one instance in the program and provide a global access point for it.
- Builder: Separate the construction of a complete object from its representation so that the same construction process can create different representations.
- Abstract Factory:
- Factory Method:
- Prototype:
- Single Responsability Principle: one class have only one reason to change
- Open/closed principle: class, object and methods most be open to extension, but closed for changes.
- Liskov substitution principle: derived classes most be able to override totaly base-class.
- Interface segregation principle: clients should not be forced to rely on interfaces they dont use.
- Deprendency inversion principle: Modules of high-level should not be rely of modules of low-level. Both must be rely of abstractions. Details mast be rely of abstractions, not the other way around.
All of design patterns will be implemented in TypeScript.