Thursday, September 16, 2010

Design Patterns

Have read countless books trying to find simple explanation of various patterns somehow nothing went into my head. Here is my mundane take on some patterns.

Facade -> Think of Dispenser which allows you to buy various goodies

Adapter -> US Plugpoint Convertor

Observer -> Newspaper/Magazine subscription, you tell them your address and they send you latest issue once published

Visitor -> Weight Machine that tells weight of the person

Command -> Remote Control, the interface to switch between DVD mode or channel switch is same. The actual data is encapsulated

Strategy ->  I am making a dish for which i want to grind something, can use Mixie or Stone. Both allow me to Grind, there by encapsulating the lower level detail.

Template-> A day has a fixed routine, morning, afternoon, evening and a night. How we spend it is upon us