Skip to content

This repository implements all of the design patterns of Gang of Four (GoF) with TypeScript.

License

Notifications You must be signed in to change notification settings

filipeas/design-patterns

Repository files navigation

Design Patterns

Description

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.

Creational

  • 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:

Principle of design object oriented (SOLID)

  • 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.

PS:

All of design patterns will be implemented in TypeScript.

About

This repository implements all of the design patterns of Gang of Four (GoF) with TypeScript.

Topics

Resources

License

Stars

Watchers

Forks