Design Patterns
Design patterns are typical solutions to common problems in software design.

Table of Contents

Each pattern is like a blueprint that you can customize to solve a particular design problem in your code.

Creational Patterns

Factory Method

This creates a set of related objects or dependent objects.

  • An abstract factory pattern acts as a super-factory that creates other factories.
  • An abstract factory interface is responsible for creating a set of related objects or dependent objects without specifying their concrete classes.

    Basically, think in terms of abstracting the methods and properties of a UML diagram

Abstract Factory

interface Door {
    getDescription(): void;
}

class WoodenDoor implements Door
{
    public function getDescription() {
        console.log("I am a wooden door");
    }
}

TODO Builder

TODO Prototype

Singleton

public Analytics {
    private static _instance: Analytics;

    private Analytics() { }

    public static getInstance(): Analytics {
        if (!Analytics._instance)
            Analytics._instance = new Analytics();

        return Analytics._instance;
    }
}

TODO Structural Patterns

Adaptive

Bridge

Composite

Decorator

Facade

Flyweight

Proxy

TODO Behavioral Patterns

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Visitor

Template Method

Date: 2021-09-13 seg 00:00

Author: Bruno Coimbra (b-coimbra)

Created: 2021-10-13 qua 13:36

Validate