Design Patterns

Updated: October 15, 2024

Design Patterns are in every language. Some patterns pertain particularly to a specific language.

Design patterns are typical solutions to common problems. These problems can exist because a language may be missing a level of abstraction. For example JS does not have Range but can be created with
an iterator pattern.

References:
Fireship
refactoring.guru


Table of Contents

Must know

Lets says window is an object, an instance.
It could have METHODS open and close, defined in a class.
Then it could have a state to track if it is open or closed, this would be a property.

CREATIONAL

Provide object creation mechanisms that increase flexibility and reuse of existing code.

Factory Method

Abstract Factory

Prototype (clone, think inheritance class)

Builder

Singleton

STRUCTURAL

Explain how to assemble objects and classes into larger structures, while keeping these structures flexible and efficient.

Facade

Proxy (substitute)

BEHAVIORAL

Take care of effective communication and the assignment of responsibilities between objects.

Iterator

Observer

Mediator

State

Strategy