Examples repository for design patterns study
https://refactoring.guru/design-patterns
https://dev.to/alexmercedcoder/oop-design-patterns-in-javascript-3i98
Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code.
- Creational(object creation, help in flexibility and reusability of code)
- Structural(explain how to assemble objects and classes into larger structures)
- Behavioral(communication between objects, how objects interact)
- Idioms (basic and low level, only to a single language)
- Architectural patterns (high level, can be applied to multiple languages, used to define the overall structure of the software)
- Singleton is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance. Example: Singleton
- Builder is a creational design pattern that lets you construct a complex object step by step. And a pattern like Director allows you to execute repetitive construction types. Example: Builder
- Factory Method is a 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. Example: Factory Method
- Abstract Factory is a creational design pattern that lets you produce families of related objects without specifying their concrete classes. Example: Abstract Factory
- Prototype is a creational design pattern that lets you copy existing objects without making your code dependent on their classes. Example: Prototype
- Object Pool is a creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand. Example: Object Pool