Skip to content

Instantly share code, notes, and snippets.

@xnuinside
Last active June 20, 2018 15:12
Show Gist options
  • Save xnuinside/0de6418355d39a3babbd857c25457861 to your computer and use it in GitHub Desktop.
Save xnuinside/0de6418355d39a3babbd857c25457861 to your computer and use it in GitHub Desktop.
List of all patterns described in "Gang of Four" book (Design Patterns: Elements of reusable Object-Oriented Software). Shortly.

In the scope of "Gang of Four" book patterns split up on three categories by their purpose: creational, structural, and behavioral. And also pattens split up by criterion, called scope, specifies whether the pattern applies primarily to classes or to objects.

Page 22.:

Class patterns deal with relationships between classes and their subclasses. These 
relationships are established through inheritance, so they are static—
fixed at compile-time. Object patterns deal with object relationships, which can be
changed at run-time and are more dynamic. Almost all patterns use inheritance to some
extent. So the only patterns labeled "class patterns" are those that focus on class
relationships. Note that most patterns are in the Object scope. 

Creational patterns

Creational patterns concern the process of object creation.

Scope: Class

Factory Method :: Page 107

Define an interface for creating an object, but let subclasses decide which class
to instantiate. Factory Method lets a class defer instantiation to subclasses.

Scope: Objects

pattern name: Abstract Factory :: Page 87

Provide an interface for creating families of related or dependent objects without 
specifying their concrete classes.

pattern name: Builder :: Page 97

Separate the construction of a complex object from its representation so that the 
same construction process can create  different representations. 

pattern name: Prototype :: Page 117

Specify the kinds of objects to create using a prototypical instance, and create
new objects by copying this prototype.

pattern name: Singleton :: Page 127

Ensure a class only has one instance, and provide a global point of access to it.

Structural patterns

Structural patterns deal with the composition of classes or objects.

Scope: Class

 Null

Scope: Objects

pattern name: Adapter :: Page 139

Convert the interface of a class into another interface clients expect. 
Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. 

pattern name: Bridge :: Page 151

Decouple an abstraction from its implementation so that the two can vary independently. 

pattern name: Composite :: Page 163

Compose objects into tree structures to represent part-whole hierarchies.
Composite lets clients treat individual objects and compositions of objects
uniformly.

pattern name: Decorator :: Page 175

Attach additional responsibilities to an object dynamically. Decorators provide a
flexible alternative to subclassing for extending functionality.

Behavioral patterns

Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility.

Scope: Class

pattern name: Interpreter :: Page 243

Given a language, define a represention for its grammar along with an
interpreter that uses the representation to interpret sentences in the language.

pattern name: Template Method :: Page 325

Define the skeleton of an algorithm in an operation, deferring some steps to
subclasses. Template Method lets subclasses redefine certain steps of an
algorithm without changing the algorithm's structure.

Scope: Objects

pattern name: Chain of Responsibility :: Page 223

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. 

pattern name: Command :: Page 233

Encapsulate a request as an object, thereby letting you parameterize clients with
different requests, queue or log requests, and support undoable operations.

pattern name: Facade :: Page 185

Provide a unified interface to a set of interfaces in a subsystem. Facade defines a
higher-level interface that makes the subsystem easier to use.

pattern name: Flyweight :: Page 195

Use sharing to support large numbers of fine-grained objects efficiently.

pattern name: Iterator :: Page 257

Provide a way to access the elements of an aggregate object sequentially without
exposing its underlying representation.

pattern name: Mediator :: Page 273

Define an object that encapsulates how a set of objects interact. Mediator
promotes loose coupling by keeping objects from referring to each other
explicitly, and it lets you vary their interaction independently.

pattern name: Memento :: Page 283

Without violating encapsulation, capture and externalize an object's internal
state so that the object can be restored to this state later.

pattern name: Observer :: Page 293

Define a one-to-many dependency between objects so that when one object
changes state, all its dependents are notified and updated automatically.

pattern name: Proxy :: Page 207

Provide a surrogate or placeholder for another object to control access to it.

pattern name: State :: Page 305

Allow an object to alter its behavior when its internal state changes. The object
will appear to change its class.

pattern name: Strategy :: Page 315

Define a family of algorithms, encapsulate each one, and make them
interchangeable. Strategy lets the algorithm vary independently from clients that
use it.

pattern name: Visitor :: Page 331

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. 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment