Friday, June 7, 2013

Design Patterns in c# , Types of Design Patterns in C#

Design Patterns:
As the OOP concept becomes widely popular in the software world, the designers start to encounter similar types of challenges in every other object-oriented design they do. Right on time, there comes a set of widely accepted solutions to these challenging problems with the name "Design Patterns".

The Design Patterns describe a set of recurring solutions to common problems in software design. This was originally described by a book written by four authors known as the "Gang of Four" or simply "GoF". Hence their pattern set was named as GoF patterns
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.

Creational Patterns:

Factory:This pattern is used to create concrete class instances without specifying the exact class type.
Abstract Factory: This pattern is used to create concrete class instances without specifying the exact class type. The Abstract Factory Pattern provides a way to encapsulate a group of individual factories that have a common theme.
Flyweight: A pattern used to maximize the sharing of objects resulting in reduced memory consumption.
Singleton: This pattern insures that only a single instance of a given object can exist.
Builder: This pattern separate the construction of a complex object from its representation so that the same construction process can create different representations.

Structural Patterns:

Adapter: Convert the interface of a class into another interface clients expect. Adapter lets the classes work together that couldn't otherwise because of incompatible interfaces
Bridge: Decouples an abstraction from its implementation so that the two can vary independently.
Composite: Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Decorator: Allows an objects behavior to be altered at runtime.
Facade: Used to provide a simpler interface into a more complicated portion of code.
Proxy: Provides a Placeholder for another object to control access to it.

Behavioral Patterns:

Chain of Responsibility: The chain of responsibility pattern is a way of communicating between objects.
Command: Encapsulates a request as an object, thereby letting you parametrize clients with different requests, queue or log requests, and support undoable operations.
Iterator: Provides a way to sequentially access aggregate objects without exposing the structure of the aggregate.
Mediator: The mediator pattern encapsulate the interaction between a set of objects.
Memento: Allows you to save the state of an object externally from that object.
Observer: Allows a single object to notify many dependent objects that its state has changed.
State: Allows an object to change its behavior when its internal state changes.
Strategy: Allows multiple algorithms to be used interchangeably at runtime.
Visitor: The visitor design pattern enables us to create new operations to be performed on an existing structure.

Template Method: Defines the skeleton of an algorithm then lets subclasses implement the behavior that can vary.

No comments:

Post a Comment