Thursday, May 27, 2010

Design Patterns


                                                                                            Design Patterns
Design Patterns are about design and interaction of objects. They provide a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges. It is a way to pursue an intent that uses classes and their methods in an OO language
Also we can say that, it is recurring solutions to software design problems you find again and again in real-world application development. Patterns are about design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.
With .NET the full capability of object-oriented programming came into the picture for the most of developers using Microsoft products.
You can do much more with .NET than with previous Microsoft technologies but it comes with a price, increased complexity. And design patterns have evolved over the time to help to keep things in order when applications become complex.
The Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral.
Creational Patterns
  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
  Structural Patterns
  Adapter
  Wrap an existing class with a new interface, 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
  Behavioral Patterns
  Chain of Resp.
  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
  Memento
  Capture and restore an object's internal state
  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

We can also categorize it :-
Interface Patterns
1     Adapter
2     Facade
3     Composite
4     Bridge
 Responsibility Patterns
1     Singleton
2     Observer
3     Mediator
4     Proxy
5     Chain of Responsibility
6     Flyweight
Construction Patterns
1     Builder
2     Factory Method
3     Abstract Factory
4     Prototype
5     Memento
Operation Patterns
1      Template Method
2     State
3     Strategy
4     Command
5     Interpreter
Extension Patterns
1     Decorator
2     Iterator
3     Visitor
Google