This repository contains examples and explanations of various design patterns. Design patterns are categorized into three types:
- Creational Patterns
- Structural Patterns
- Behavioral Patterns
Each type has its own folder with detailed explanations and examples of the design patterns it contains.
Creational patterns provide various object creation mechanisms, which increase flexibility and reuse of existing code. Examples include:
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
Structural patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient. Examples include:
- Adapter
- Composite
- Proxy
- Flyweight
- Facade
- Bridge
- Decorator
Behavioral patterns are concerned with algorithms and the assignment of responsibilities between objects. Examples include:
- Chain of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
Each pattern has its own folder with a detailed README file explaining the pattern, its use cases, and examples.
This repository was created using information and examples from the following sources:
First install dependecies with npm install, then run npx tsx [file-route] for example: npx tsx creational/builder/builder.ts