Skip to content

IbrahimSassi/Javascript_DesignPatterns

Repository files navigation

Javascript Design Patterns

This repo will show you tried and true design patterns to help structure and organize your code to make your JavaScript code more readable and maintainable

1. Creational Design patterns

Used to create new objects, adapting creation to the situation

  • Constructor Pattern

Use to create new objects with their own object scope

  • Module Pattern

Simple way to encapsulate methods

  • Factory Pattern

Used to simplify object creation

  • Singleton Pattern

Used to restrict an object to one instance of that object across the application

2. Structural Design patterns

Concerned with how objects are made up and simplify relationships between objects

  • Decorator Pattern

Used to add new functionality to an existing object, without being obtrusive

  • Facade Pattern

Used to provide a simplified interface to a complicated system

  • Flyweight Pattern

Conserves memory by sharing portions of an object between objects

3. Behavioral Design patterns

Concerned with the assignment of responsibilities between objects and how they communicate

  • Observer Pattern

Allows a collection of objects to watch an object and be notified of changes

  • Mediator Pattern

Controls communication between objects so neither object has to be coupled to the others

  • Command Pattern

Encapsulates the calling of a method as an object

Releases

No releases published

Packages

No packages published