This repository contains a collection of design patterns implemented in TypeScript. These patterns provide reusable solutions to common software design problems.
Clone the repository and install the dependencies:
git clone https://github.com/subahanumanth/design-patterns.git
cd design-patterns
npm install
- Singleton: Ensure a class has only one instance and provide a global point of access to it.
- Factory: Define an interface for creating an object, but let subclasses alter the type of objects that will be created.
- Abstract Factory: Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
- Builder: Separate the construction of a complex object from its representation, allowing the same construction process to create different representations.
- Observer: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
- Strategy: Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
- Adapter: Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
- Facade: Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.