Skip to content

pncsoares/javascript-design-patterns

Repository files navigation

Design Patterns

Design patterns written in JavaScript and TypeScript.

Definition

A software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system.

👆 Source

In my opinion, this defines very well what a design pattern is.

Advantages of using them

  • Promote easier changes
  • Turns the objects reusable
  • Keeps objects small and specialized

Types

  • Creational patterns
  • Structural patterns
  • Behavioral patterns
  • Concurrency patterns

Code examples

Type Name Information
Creational patterns Builder Go to detail 📄
Creational patterns Singleton Go to detail 📄
Structural patterns Facade Go to detail 📄
Behavioral patterns Command Go to detail 📄
Behavioral patterns Null Object Go to detail 📄

Another design patterns that I will add in the future:

  • Factory
  • Observer
  • Decorator
  • Strategy
  • Adapter
  • Iterator
  • Proxy
  • Composite
  • Bridge

Setup

Clone repository

Create and go to the directory where you want to place the repository

  cd my-directory

Clone the project

  git clone https://github.com/pncsoares/javascript-design-patterns.git

Go to the project directory

  cd javascript-design-patterns

License

MIT