Saturday, March 10, 2012

Existing Design Patterns in Microsoft.Net

You may not know it, but if you have been working with the Microsoft.Net platform for any length of time, there are numerous Design Patterns which have been implemented natively by the Microsoft.Net Framework.

Here are just some of the common Design Patterns:


  1. If you have ever worked with creating a Collection and then looping through it using a foreach loop, you have used the Iterator Pattern.
  2. If you have ever used a StringBuilder to build strings (hence its name), you have used the Builder Pattern.
  3. If you have ever used Serialization of objects using XML Serialization attributes or DataContract Serialization attributes for WCF, you have used a form of the Decorator Pattern.
  4. If you have ever used Web Services (ASMX or WCF), you have used the Proxy Pattern.
  5. If you have ever worked with a static class constructor, you have used the Singleton Pattern.
  6. If you have ever worked with the DbFactory class in ADO.Net, you have used the Factory Method Pattern.
  7. If you have ever worked with DataBinding expressions in ASP.Net or just plain old XML, you have used the Interpreter Pattern.
  8. If you have ever written extension methods, you have used the Bridge Pattern.
  9. If you have ever worked with a SqlDataAdapter object, you have used the Adapter Pattern.
  10. If you have ever worked with a SqlCommand object, you have used the Command Pattern.
  11. If you have ever used the Copy or Clone methods on a DataSet, you have used the Prototype Pattern.
  12. If you have ever worked with Events (such as a Button Click event), you have used the Observer Pattern.
  13. If you have ever worked with templated controls in ASP.Net such as the Wizard control or the various ASP.Net AJAX Controls, you have used the Template Method Pattern.
  14. If you have ever worked with a State Machine Workflow in SharePoint, you have used the State Pattern.
  15. If you have ever worked with any of the various Providers such as MembershipProvider, RoleProvider, ProfileProvider or SiteMapProvider, you have used multiple Design Patterns:
    • Strategy Pattern
    • Factory Method Pattern
    • Singleton Pattern
    • Facade Pattern



So if someone ever asks you if you have ever worked with Design Patterns, you HAVE!

2 comments:

  1. Great Explanation. Another great article i recommend is:

    this

    ReplyDelete
  2. http://thecafetechno.com/tutorials/design-patterns/proxy-pattern-in-java

    ReplyDelete