Welcome to Vishwa's blog - Technology, Spirituality and More...

Types Of Design Patterns

In Software Development, a design pattern is generally used as a reusable solution to a commonly occurring problem within a given context in software design. A design pattern is a template or format for how to solve a problem that can be used in many different situations. These Patterns are design and interaction of objects, as well as providing a communication platform for elegant and reusable solution.


There are hundreds of Design Patterns available today but the Gang of Four (GoF) - only considered 23 patterns as the foundation patterns. They categorized in three groups. These patterns are not any Language specific.


(For better focus, each pattern is listed in the group as per their uses. The number in bracket indicates the uses in Microsoft.NET on the scale of 1-5, where 5 is the highest.)


A. Creational Patterns: Helps with creating objects. They abstract the instantiation process of objects and thereby help make a system independent of how its objects are created. These patterns have two common things –

  • Hide the concrete classes the system uses to create objects
  • Hide how instances of these classes are created and composed together

Main Creational Patterns:

  1. Abstract Factory(5) - Creates an instance of several families of classes
  2. Factory Method (5)- Creates an instance of several derived classes
  3. Singleton(4) - A class of which only a single instance can exist
  4. Prototype (3)- A fully initialized instance to be copied or cloned
  5. Builder(2) - Separates object construction from its representation


B. Structural Patterns: It deals with how objects can be composed into a larger Structure. It is usually done by either of two ways

  • Object composition – grouping objects together
  • Interface – Using or extending class’s interface and capabilities at runtime


Main Structural Patterns are

  1. Façade (5) - A single class that represents an entire subsystem
  2. Proxy (4) - An object representing another object
  3. Adapter (4)- Match interfaces of different classes
  4. Composite (4) - A tree structure of simple and composite objects
  5. Bridge (3) - Separates an object’s interface from its implementation
  6. Decorator (3) - Add responsibilities to objects dynamically
  7. Flyweight (1) - A fine-grained instance used for efficient sharing


C. Behavioral Patterns: It deals with algorithms, communication and dispatching of responsibilities between objects. By doing so, these patterns increase flexibilities in carrying out this communication. They shift your focus from flow of control to the way objects are interconnected.


Main Behavioral Patterns are

  1. Iterator (5) - Sequentially access the elements of a collection
  2. Observer(5) - A way of notifying change to a number of classes
  3. Strategy (4) - Encapsulates an algorithm inside a class
  4. Command (4)- Encapsulate a command request as an object
  5. State (3)- Alter an object's behavior when its state changes
  6. Template Method (3) - Defer the exact steps of an algorithm to a subclass
  7. Chain of Responsibilities (2) - A way of passing a request between a chain of objects
  8. Mediator (2) - Defines simplified communication between classes
  9. Interpreter (1) - A way to include language elements in a program
  10. Memento (1)- Capture and restore an object's internal state
  11. Visitor (1) - Defines a new operation to a class without change


There is lots of information available on this topic on the internet. Just wanted to summarize the main patterns first and later write an example on highly used Patterns in .NET. A lot more Design Patterns have evolved over the years and after the above core patterns; some of the above patterns were modified and given a new name or mixed with something new. Some of the design patterns are already implemented in .NET and we use on daily basis.