Design Patterns

Inputs: Google, C#3.0 design patters by Judith Bishop
Outputs: Below. This is how I understood design patterns... I try to put them in a abstract way... concisely...
Processor: Error prone... my brain!

A Design pattern is  general solution to commonly occurring problem in software design. In fact solutions to commonly occuring OOPS issues. One level down the Object Oriented Programming cannot support itself hence needs a design paradigm. Most of us will be using patterns even without knowing that we are using a pattern in many scenarios.

Structural patterns:

Decorator pattern: What it is: It can be simply said runtime subclassing. subclassing is extending the functionality of class at compile time itself. Whereas decorator pattern involves extending the functionality at runtime. It can be also said that adding functionality dynamically to an object is possible by decorator pattern. When to use: This pattern is fit if subclassing will lead to too many.

Proxy pattern: What it is: Proxy pattern implements call forwarding mechanism. It helps to create objects on demand wherever object creation is expensive. Good example is the world of DCOM and Remoting. Where proxies will be middle man and clients query them as local objects. The actual call will be executed in remote machine.When to use: If objects needs to be created on demand. If some misc activities needs to be performed when a call is made. Example for misc activities include authentication, authorization, licensing etc.,

Proxy vs Decorator: Do you think they can be compared?! May be in one aspect... that is the call forwarding aspect. They both forward calls. But proxies always forward call to the same object it creates. It is fixed at design time. But in case of decorator it is dynamic.Decorator objects can hold instance of any type of components or even to another decorator itself!