The catalog of GOF (Gang-of-Four) patterns contains 23 design patterns. They are listed below:
Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
Decouple (separate) the abstraction from its implementation so that the two can vary independently.
Separate (hide) the construction process from its representation so that the same construction process can create different representations.
Chain of Responsibility:
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
Encapsulate a request as an object which allows us to parametrize the clients with different requests and support undoable operations.
Combine objects into tree structures to form part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub classing for extending functionality.
Provide a uniform interface for a set of interfaces in a subsystem. Façade defines a higher level interface to make the subsystem easier to use.
Defines an interface to create an object, but lets subclasses decide which class to instantiate. Factory Method lets a class differ instantiation to subclasses.
Use sharing to support large numbers of fine-grained objects efficiently.
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Provides a way to access the individual elements of an aggregate object without exposing its underlying representation.
Define an object that encapsulates how a set of objects interact.
Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.
Defines a one-to-many dependency between objects so that if one object changes its state, it will notify the change to all other objects and update automatically.
Specifies the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Provide a placeholder for another object to control access to it.
Ensure a class has only one object and a global point of access to that object.
Allow an object to change its behavior when its internal state changes. The object will appear to change its class.
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Define the skeleton of an algorithm in an operation, deferring some steps to sub classes.
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.