Design Patterns In .NET


Design patterns are solutions to problems in software architecture. They are re-usable, high quality solution to a given requirement, task or recurring problem.

Design patterns are used throughout the ASP.NET Framework.  The various patterns are commonly divided into several different groups depending on the nature of the design problem they intend to solve.

There are 4 basic patterns namely Creational, Structural, Behavioral and Antipatterns.

1. Creational Pattern:

It deals with object creation mechanisms.

Pattern

Description

Abstract Factory

Creates an instance of several families of classes

Builder

Separates object construction from its representation

Factory Method

Creates an instance of several derived classes

Prototype

A fully initialized instance to be copied or cloned

Singleton

A class of which only a single instance can exist

2. Structural Patterns:

It eases the design by identifying a simple way to realize relationships between entities.

Pattern

Description

Adapter

Match interfaces of different classes

Bridge

Separates an object’s interface from its implementation

Composite

A tree structure of simple and composite objects

Decorator

Add responsibilities to objects dynamically

Facade

A single class that represents an entire subsystem

Flyweight

A fine-grained instance used for efficient sharing

Proxy

An object representing another object

3. Behavioral Patterns:

It describes how different objects and classes interact with each other to make things happen.

Pattern

Description

Chain of Responsibility

A way of passing a request between a chain of objects

Command

Encapsulate a command request as an object

Interpreter

A way to include language elements in a program

Iterator

Sequentially access the elements of a collection

Mediator

Defines simplified communication between classes

Observer

A way of notifying change to a number of classes

State

Alter an object’s behavior when its state changes

Strategy

Encapsulates an algorithm inside a class

Template Method

Defer the exact steps of an algorithm to a subclass

Visitor

Defines a new operation to a class without change

4. Antipatterns:

There are misapplied design patterns.

Pattern

Description

The Blob/God Object

When one class contains all of the methods, operations and logic of your application

Re-Coupling

building an unnecessary dependency between objects

Poltergeists

object whose main purpose in life is to pass messages to another object

Sequential Coupling

a class that imposes a particular order on its method calls

 

Advertisements

3 thoughts on “Design Patterns In .NET

  1. thomas joe

    Really a great information regarding design patterns for everyone and especially for me because by profession i am a .Net developer and always looking for new things in .Net. Thanks for sharing this post.

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s