Skip to content

About

Examples repository for design patterns study

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

design-patterns

Examples repository for design patterns study

Links

https://refactoring.guru/design-patterns
https://dev.to/alexmercedcoder/oop-design-patterns-in-javascript-3i98

What is a design pattern

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.

Types of design patterns

  • 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)

Complexity

  • 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)

Examples

Creational

Singleton

  • 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

  • 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

  • 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

  • Abstract Factory is a creational design pattern that lets you produce families of related objects without specifying their concrete classes. Example: Abstract Factory

Prototype

  • Prototype is a creational design pattern that lets you copy existing objects without making your code dependent on their classes. Example: Prototype

Object Pool

  • 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

About

Examples repository for design patterns study

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages