Design Patterns

 Rate It (42)

Design Patterns

Design patterns are recognized solutions to common problems defined originally by the Gang of Four programmers. 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 independantly.
  • 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 parameterize 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 behaviour 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 behaviour that can vary.

Antipatterns

Antipatterns are misapplied design patterns. Common Antipatterns include:

  • 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. 

Other patterns

Videos

Articles

Books

 

Revision number 41, Wednesday, November 04, 2009 6:23:27 PM by Dungimon

Comments

The way "Factory" and "Abstract Factory" are explained above. Is there any difference between them. I see same line for both

Difference between the two is that with the Abstract Factory pattern, a class delegates the responsibility of object instantiation to another object via composition whereas the Factory Method pattern uses inheritance and relies on a subclass to handle the desired object instantiation.

the abstract factory pattern Provides an interface for creating families of related or dependent objects without specifying their concrete classes. whereas the factory pattern Defines an interface for creating an object, but let subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.

It's good Article. In the creational Patterns category we can add 'Prototype' and 'builder' Patterns.

This is really help full.

I'm looking for information on the repository pattern because it seems to be of much importance in ASP.NET MVC.

Good Job!

Its really great effort!

this is really help full

Good one!

Related Articles

Provider Model

Provider ModelThe provider model patternwas designed toprovide a configurable component for data access which isdefined from the web.config. The Provider interfacesbetween the Business logic and Data Access. The actual concrete implementation of the provider

Strategy

Strategy The Strategydesign pattern allows you to use multiple algorithms interchangeably. One reason you might use a Strategy Pattern is to simplify an overly complex algorithm. Sometimes, as an algorithm evolves to handle more and more situations,it can

Security

ASP.NET security is a huge topic and we're only scratching the surface. Let's continue to categorize in the add new content around security to make thisa greatresource.This isjust the overview page, make sure to visit thesubpages fromthe Table ofContents

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. mbanavige (14)
  2. codehard (3)
  3. Babunareshnarra (2)
  4. Dungimon (1)
  5. cabhilash (1)
Microsoft Communities