Simple factory

The Simple Factory, where a Factory object decides which instance of a product class to create, is the simplest and most practical pattern in the family of Factory patterns.

The factory method

Factory Method, which defines an interface for creating objects and lets subclasses decide which class to instantiate, delays the instantiation of a class to its subclasses. To follow the extended open, modify the closed principle, convert a simple factory class into a factory method interface, split its Switch branch into subclasses to inherit the factory method interface class, and smoothly defer the process of creating objects to the subclass.

The abstract factory

Abstract Factory provides an interface to create a series of related or interdependent objects without specifying their concrete classes.

Prototype mode

Specify what kind of objects to create with prototype instances, and create new objects by copying these prototypes.

The Builder

Separating the construction of a complex object from its representation allows the same construction process to create different representations.

Singleton (Singleton)

Ensure that a class has only one instance and provide a global access point to access it

Adapter

By transforming the interface of one class into another interface that the customer wants, the Adapter pattern enables classes that would otherwise not work together due to interface incompatibilities.

Proxy

Provide a proxy for other objects to control access to that object.

Composite

By combining objects into a tree structure to represent a parties-whole hierarchy, the composite pattern enables consistency in the use of individual objects and composite objects.

Bridge

Separate the abstract part from its implementation part so that they can all change independently.

flyweight

Support a large number of fine-grained objects efficiently using sharing techniques.

Facade

To provide a consistent interface for a set of interfaces in a subsystem, this pattern defines a high-level interface that makes the subsystem easier to use.

Decorator

Adding additional responsibilities to an object dynamically makes decorating more flexible than subclassing in terms of adding functionality.

Memento

Capture the internal state of an object and store the state outside of the object without breaking encapsulation. This allows you to later restore the object to its original saved state

Command

Encapsulating a request as an object allows you to parameterize customers with different requests, queue or log requests, and support undoable operations.

Strategy

It defines a family of algorithms and encapsulates them so that they can be replaced with each other, so that changes in the algorithm do not affect the customers who use the algorithm.

TemplateMethod

Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. The template approach allows subclasses to redefine specific steps of an algorithm without changing the structure of that algorithm.

An Observer

Defines a one-to-many dependency that lets multiple observer objects listen on a subject object at the same time. The topic object notifies all observer objects when their state changes, enabling them to update themselves automatically.

Iterators

Provides a way to access the elements of an aggregate object sequentially without exposing the internal representation of the object.

Chain of Responsibility

This avoids coupling between the sender and receiver of the request by giving multiple objects the opportunity to process the request. Concatenate the object into a chain and pass the request along the chain until a pair processes it.

Broker (Mediator)

A mediator object encapsulates a set of object interactions. The mediator makes objects loosely coupled without explicitly referring to each other, and can change their relationships independently

State (State)

Allowing an object to change its behavior when its internal state changes, the object appears to have changed its class.

Visitor

Represents an operation that operates on each element of an object structure. It allows you to define new operations that operate on elements without changing their classes.