Facade Design Pattern.

Where to use?

   When there are some sub tasks or series of subsystems.

In such cases we need to bother about all the subsystems or we can say we need to remember all the classes, methods and sequence of calling. So to avoid this situation, we can use Facade pattern which provides an interface to client code and hide all the subsystems.

Lets takes an example for facade design pattern. Suppose I need to turn off my Desktop. So the activities involve in this task is : 1. Save my Work and ShutDown Windows. 2. Turn off Monitor 3. Turn off UPS. So there are 3 subsystems and my program looks like: There are 3 different classes with their respective methods. Continue reading

Abstract factory vs Factory pattern

An Abstract Factory is aimed at creating groups of related objects. The interface of an Abstract Factory will typically contain a number of Factory Methods, one for each type of object to be created.

The main difference between a “factory method” and an “abstract factory” is that the factory method is a single method, and an abstract factory is an object. Continue reading

Observer design pattern

The observer design pattern is yet another, one of my favorite design patterns which falls in the category of “behavioral pattern“. Going by its name, we can say that observer is something (objects in case of OOPS) which islooking upon (observing) other object(s). Observer pattern is popularly known to be based on “The Hollywood Principle” which says- “Don’t call us, we will call you.” Pub-Sub (Publisher-Subscriber) is yet another popular nickname given to Observer pattern. Continue reading

Facade Pattern.

The Facade pattern is a common software design pattern used to create a simple unified interface for a set of interfaces in a system. The Facade interface is a higher-level interface that allows easier control of a set of subsystem interfaces without affecting the subsystem interfaces.The Facade pattern encourages composition over inheritance, and is a good way to clean up and simply a set of complex subsystems into one more simple, higher-level interface. Continue reading

Common Design Patterns in C#

1. http://www.abhisheksur.com/2010/05/design-patterns.html
2. http://www.dofactory.com/Patterns/Patterns.aspx
3. http://csharpdesignpatterns.codeplex.com/
4. http://stackoverflow.com/questions/5039752/when-to-use-which-design-pattern
5. http://www.codeproject.com/Articles/33530/Design-Pattern-Examples-in-C