Object-oriented design patterns implemented in TypeScript
The curated collection of idiomatic design and application patterns for the TypeScript programming language.
Pattern | Description |
---|---|
Factory Method | The creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created |
Abstract Factory | The creational design pattern that produces families of related objects without specifying their concrete classes |
Prototype | The creational design pattern that copies existing objects without making the code dependent on their classes |
Singleton | The creational design pattern which ensures that a class has only one instance, while providing a global access point to this instance |
Pattern | Description |
---|---|
Adapter | The structural design pattern that allows objects with incompatible interfaces to collaborate |
Bridge | The structural design pattern that splits a large class or a set of closely related classes into two separate hierarchies—abstraction and implementation—which can be developed independently of each other |
Composite | The structural design pattern that allows composing objects into a tree-like structure and work with the it as if it was a singular object |
Decorator | The structural design pattern that attaches new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors |
Facade | The structural design pattern that provides a simplified interface to a library, a framework, or any other complex set of classes |
Proxy | The structural design pattern that provides a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object |
Pattern | Description |
---|---|
Chain of Responsibility | The behavioral design pattern that passes requests along a chain of handlers |
Iterator | The behavioral design pattern that traverse elements of a collection without exposing its underlying representation |
Observer | The behavioral design pattern that defines a subscription mechanism to notify multiple objects about any events that happen to the object they're observing |
State | The behavioral design pattern that lets an object alter its behavior when its internal state changes |
Strategy | The behavioral design pattern that defines a family of algorithms, put each of them into a separate class, and make their objects interchangeable |
Template Method | The behavioral design pattern that defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure |
Visitor | The behavioral design pattern that separates algorithms from the objects on which they operate |