Design Patterns

 Rate It (31)

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

Structural Patterns

  • Adapter - Convert the interface of a class into another interface clients expect. Adpater 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 strutures 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

  • Observer
  • State - Allows an object to change it behaviour when its internal state changes.
  • Strategy - Allows multiple algorithms to be used interchangeably at runtime.
  • Visitor
  • Template Method -  Defines the skeleton of an algorithm then lets subclasses implement the behaviour that can vary.

Anitpatterns

Antipatterns are misapplied design patterns. Common Antipatterns include:

  • The Blob - When one class contains all of the methods, operations and logic of your application

Videos

Articles

Books

 

Revision number 26, Friday, June 13, 2008 6:24:48 AM by
This is not the most up to date version of this article. The most recent version can be found here.

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.

Related Articles

Proxy

Proxy Design Pattern The Gang Of Four definition of this design pattern is "Provides a surrogate or placeholder for another object to control access to it". In the example below we use the pattern to enable caching on an ASP.net page. This code uses the Factory

MVP Pattern

MVP (Model View Presenter)Framework The MVP pattern is an Architecture Pattern used to build ASP.net applications. It refers to splitting up the responsibilities for gathering, displaying, and storing data from a web page into separate objects: a Model object

Singleton

Singleton The Singleton Design Pattern ensures that only a single instance of a given object can exist. It does this by making the class constructorprivate so that it [the singleton itself]has full controlover when the class instance is created. In order to

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. mbanavige (5)
  2. SGWellens (4)
  3. maartenba (2)
  4. rami_nassar (2)
  5. stiansol (2)
  6. MisterFantastic (2)
  7. satish1.v (1)
  8. raklos (1)
  9. mosessaur (1)
  10. Jos Branders (1)

Advertise Here

Microsoft Communities
Page view counter