Please enable Javascript to correctly display the contents on Dot Net Tricks!

Gang of Four (GOF) Design Patterns in .Net

  Author : Shailendra Chauhan
Posted On : 25 May 2013
Total Views : 80,229   
Updated On : 06 Jul 2017
 

In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book (Design Patterns: Elements of Reusable Object-Oriented Software) for explaining the concept of Design Pattern in Software development. These four authors are collectively known as Gang of Four (GOF).

GOF Design Patterns

The 23 Design patterns are defined by the Gang of Four programmers. These 23 patterns are divided into three groups depending on the nature of the design problem they intend to solve.

  1. Creational Design Patterns

    These patterns deal with the process of objects creation in such a way that they can be decoupled from their implementing system. This provides more flexibility in deciding which objects need to be created for a given use case/ scenario. There are as follows:

    1. Factory Method : Create instances of derived classes

    2. Abstract Factory : Create instances of several classes belonging to different families

    3. Builder : Separates an object construction from its representation

    4. Prototype : Create a duplicate object or clone of the object

    5. Singleton : Ensures that a class can has only one instance

  2. Structural Design Patterns

    These patterns deal with the composition of objects structures. The concept of inheritance is used to compose interfaces and define various ways to compose objects for obtaining new functionalities. There are as follows:

    1. Adapter : Match interfaces of different classes

    2. Bridge : Separates an object’s abstraction from its implementation

    3. Composite : A tree structure of simple and composite objects

    4. Decorator : Add responsibilities to objects dynamically

    5. Façade : A single class that represents an entire complex system

    6. Flyweight : Minimize memory usage by sharing as much data as possible with similar objects

    7. Proxy : Provides a surrogate object, which references to other object

  3. Behavioral Design Patterns

    These patterns deal with the process of communication, managing relationships, and responsibilities between objects. There are as follows:

    1. Chain of Responsibility: Passes a request among a list or chain of objects.

    2. Command: Wraps a request under an object as a command and passed to invoker object.

    3. Interpreter: Implements an expression interface to interpret a particular context.

    4. Iterator: Provides a way to access the elements of a collection object in sequential manner without knowing its underlying structure.

    5. Mediator: Allows multiple objects to communicate with each other’s without knowing each other’s structure.

    6. Memento: Capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation.

    7. Observer: Allows an object (subject) to publish changes to its state and other objects (observer) that depend upon that object are automatically notified of any changes to the subject's state.

    8. State: Alters the behavior of an object when it’s internal state changes.

    9. Strategy: Allows a client to choose an algorithm from a family of algorithms at run-time and gives it a simple way to access it.

    10. Visitor: Creates and performs new operations onto a set of objects without changing the object structure or classes.

    11. Template Method: Defines the basic steps of an algorithm and allow the implementation of the individual steps to be changed.

What do you think?
I hope you will enjoy the GOF design patterns while designing your software. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.


Free Interview Books
 
COMMENTS (0)
3 AUG
ASP.NET Core with Angular4 Development (Online)

07:00 AM - 9:00 AM IST(+5:30 GMT)

Know More
29 JUL
Angular2 and Angular4 Development (Online)

08:00 AM - 10:00 AM IST(+5.30 GMT)

Know More
29 JUL
ASP.NET MVC with Angular4 Development (Classroom)

09:30 AM - 11:00 AM IST (+5:30GMT)

Know More
29 JUL
Xamarin Forms : Build Cross-platform Apps (Classroom)

09:00 AM - 11:00 AM IST(+5:30 GMT)

Know More
26 JUL
ASP.NET MVC with Angular4 Development (Online)

07:00 AM - 09:00 AM IST(+5.30 GMT)

Know More
22 JUL
MEAN Stack 2 Development (Classroom)

04:00 PM - 05:30 PM IST(+5:30GMT)

20 JUL
Hadoop Development cum Administration (Online)

07:00 AM - 09:00 AM IST(+5:30 GMT)

17 JUL
NodeJS with Angular4 Development (Online)

08:00 PM - 09:30 PM IST(+5.30 GMT)

15 JUL
ASP.NET MVC with Angular4 Development (Online)

03:30 PM - 05:30 PM IST(+5.30 GMT)

1 JUL
ASP.NET MVC with Angular4 Development (Classroom)

08:00 AM - 09:30 AM IST

1 JUL
MEAN Stack 2 Development (Classroom)

11:00 AM - 12:30 PM IST(+5:30 GMT)

30 JUN
Xamarin Forms : Build Cross-platform Apps (Online)

09:30 PM - 11:00PM IST(+5:30GMT)

6 JUN
ASP.NET MVC with Angular4 Development (Online)

09:00 PM-11:00 PM IST(+5.30 GMT)

20 MAY
NodeJS with Angular4 Development (Classroom)

05:00 PM - 07:00 PM

2 MAY
ASP.NET Core Development (Online)

07:00 AM - 09:00 AM IST(+5.30 GMT)

BROWSE BY CATEGORY
 
 
LIKE US ON FACEBOOK
 
+