/design-pattern-ts

📚 Typescript design pattern implementations

Primary LanguageTypeScript

Design Patterns

A collection of implementations of the main Typescript design patterns, as part of a study of Vinicius Vivan's course (rabiscando padroes de projeto) on the subject

Creational

  • Factory Method Creates an instance of several derived classes
  • Abstract Factory Creates an instance of several families of classes
  • Builder Separates object construction from its representation
  • Singleton A class of which only a single instance can exist
  • Prototype A fully initialized instance to be copied or cloned

Structural

  • Adapter Match interfaces of different classes
  • Decorator Add responsibilities to objects dynamically
  • Facade A single class that represents an entire subsystem
  • Bridge Separates an object's interface from its implementation
  • Proxy An object representing another object
  • Composite A tree structure of simple and composite objects
  • Flyweight A fine-grained instance used for efficient sharing

Behavioral

  • Strategy Encapsulates an algorithm inside a class
  • Template Method Defer the exact steps of an algorithm to a subclass
  • Observer A way of notifying change to a number of classes
  • State Alter an object's behavior when its state changes
  • Chain of Responsibility A way of passing a request between a chain of objects
  • Iterator Sequentially access the elements of a collection
  • Command Encapsulate a command request as an object
  • Visitor Defines a new operation to a class without change
  • Memento Capture and restore an object's internal state
  • Mediator Defines simplified communication between classes
  • Interpreter A way to include language elements in a program