Design Patterns Tutorial
A tutorial on GOF design patterns. This tutorial is for beginners who are going to learn design patterns for the first time. Each pattern is expalined with suitable examples.

15/11/2013 Categories: Introduction. 1 Comment on Catalog of design patterns

The catalog of GOF (Gang-of-Four) patterns contains 23 design patterns. They are listed below:


Abstract Factory:

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.


Factory Method:

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.


Template Method:

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.

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

1 Comment

You can follow any responses to this entry through the RSS 2.0 feed.

Very good info. Lucky me I found your blog by chance (stumbleupon).
I have saved as a favorite for later!

Leave a Reply

Scroll Up