Friday 27 December 2013

Different Design Patterns present in the C# Dotnet Framework

In this article we are going to see the various design patterns present in the Dotnet Framework. Design Patterns are used to outline the main issues faced in the software industry.The patterns are divided in to the Three Groups

Different types of Design Patterns and there sub categories.

1. Creational Patterns
2. Structural Patterns
3. Behavioral Patterns

Creational Patterns

    Prototype Pattern
        This pattern is used to return a instance of a object by using it's prototype and the class itself create a clone of that object with in the instance.

    Factory Pattern
               Factory pattern is the implementation of creating a Instance to the user but not exposing the instance logic to the client , using Interface implementation.

    Factory Method
              It also like factory class, The object of the class is created through interface implementation but the kind of object instance is decide by the derived class not by the base class base class is a Abstract class.

    Abstract Factory
               It is an extension of the Factory pattern,  where the interface are declared in the Factories so it works in a similar way of Factory.The derived class from a abstract class returns the instance of a  class that need with Interface implementation as return type.

    Builder Pattern
               Builder pattern returns a instance from  a class based on the input , which have same interface implemented and then perform the some task before the return of instance.            

    Singleton Pattern  
               Singleton pattern creates a instance of a class which can have only one instance even though many request is given it reuses the same object to perform the operation.

Structural Patterns
    Adapter Pattern
               Converts one instance of a class in to another,it makes two class compatible.

    Bridge Pattern
               It composes objects in to tree structure.It decouples abstraction from a implementation. abstraction represents the client where from the objects will be called .

    Decorator Pattern
           It is same as the Inheritance concept.

    Composite Pattern
         It is a pattern in which each component are acts as individual so it can be separated easily.

    FlyWeight Pattern
          It is used to share the common data between the objects.

Behavioral Patterns
    
Mediator Pattern
        This pattern is used to make objects loosely coupled.

    Observer Pattern
        This pattern is when two or more objects have relationship then if the parent object is modified then it should  notify to all dependent object. Ex : Observable collection

Real time scenario : Publisher and subscriber model

    Iterator Pattern
         This pattern is used to iterate the elements from the collections. IEnumerable is the Interface is example one
 
From this article you can learn what are the design patterns present in the C# Dotnet framework.

No comments:

Post a Comment