Structural Design Patterns
Flyweight is used when there is a need to create high number of objects of almost similar nature. High number of objects consumes high memory and flyweight design pattern gives a solution to reduce the load on memory by sharing objects. It is achieved by segregating object properties into two types intrinsic and extrinsic. In […]
Published to Design Patterns Tutorial on 24/06/2012.
When we want to represent part-whole hierarchy, use tree structure and compose objects. We know tree structure what a tree structure is and some of us don’t know what a part-whole hierarchy is. A system consists of subsystems or components. Components can further be divided into smaller components. Further smaller components can be divided into […]
Published to Design Patterns Tutorial on 13/05/2012.
“Provide a surrogate or placeholder for another object to control access to it” is the intent provided by GoF. Proxy means ‘in place of’. In attendance roll call, we give proxy for our friends in college right? ‘Representing’ or ‘in place of’ or ‘on behalf of’ are literal meanings of proxy and that directly explains […]
Published to Design Patterns Tutorial on 01/04/2012.
“Decouple an abstraction from its implementation so that the two can vary independently” is the intent for bridge design pattern as stated by GoF. Bridge design pattern is a modified version of the notion of “prefer composition over inheritance”. Problem and Need for Bridge Design Pattern When there are inheritance hierarchies creating concrete implementation, you loose […]
Published to Design Patterns Tutorial on 05/02/2012.
GoF definition for facade design pattern is, “Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.” How do we infer the above definition? Think of a component that solves a complex business problem. That component may expose lot of […]
Published to Design Patterns Tutorial on 29/01/2012.
To extend or modify the behaviour of ‘an instance’ at runtime decorator design pattern is used. Inheritance is used to extend the abilities of ‘a class’. Unlike inheritance, you can choose any single object of a class and modify its behaviour leaving the other instances unmodified. In implementing the decorator pattern you construct a wrapper […]
Published to Design Patterns Tutorial on 17/05/2011.
An adapter helps two incompatible interfaces to work together. This is the real world definition for an adapter. Adapter design pattern is used when you want two different classes with incompatible interfaces to work together. The name says it all. Interfaces may be incompatible but the inner functionality should suit the need. In real world the […]
Published to Design Patterns Tutorial on 07/05/2011.