Geeks With Blogs
Asif Maniar Software Engineer February 2012 Entries
A Simple implementation of the Decorator Design Pattern using C#
The main motivation before the decorator pattern is to be able to add data and behavior to objects dynamically without relying on inheritance. A decorator usually conforms to the interface of the component its decorating. Lets see this with an example. Am building a system that calculates the price of a pizza. I can have many toppings and the total price of the pizza is calculated based on what toppings I pick. One way to do this would be to use inheritance and class hierarchies like Pizza, CheesePizza, ......

Posted On Friday, February 10, 2012 4:05 PM

A Simple implementation of the Proxy Design Pattern using C#
A proxy is an object that can be used to control creation and access of a more complex object thereby deferring the cost of creating it until the time its needed. Below is a simple implementation of the proxy pattern in C#. The ComplexProtectedExpensiveRe... is private to the ProxyContainer and cannot be instantiated by a client. The client creates an instance of the SimpleProxy class which controls its access to the more complex and expensive to create ComplexProtectedExpensiveRe... class. ......

Posted On Tuesday, February 7, 2012 4:02 PM

Copyright © Asif Maniar | Powered by: