Design Patterns

Recent Articles

Composite Design Pattern

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 Structural Design Pattern Tutorial on 13/05/2012.

Proxy Design Pattern

“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 Structural Design Pattern Tutorial on 01/04/2012.

Bridge Design Pattern

“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 Structural Design Pattern Tutorial on 05/02/2012.

Facade Design Pattern

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 Structural Design Pattern Tutorial on 29/01/2012.

Decorator Design Pattern

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 Structural Design Pattern Tutorial on 17/05/2011.

Adapter Design Pattern

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 Structural Design Pattern Tutorial on 07/05/2011.

Singleton Design Pattern

Singleton design pattern is the first design pattern I learned (many years back). In early days when someone asks me, “do you know any design pattern?” I quickly and promptly answer “I know singleton design pattern” and the question follows, “do you know anything other than singleton” and I stand stumped! A java beginner will […]
Published to Creational Design Pattern Tutorial on 02/05/2011.

Prototype Design Pattern

When creating an object is time consuming and a costly affair and you already have a most similar object instance in hand, then you go for prototype pattern. Instead of going through a time consuming process to create a complex object, just copy the existing similar object and modify it according to your needs. Its […]
Published to Creational Design Pattern Tutorial on 14/07/2010.

Builder Design Pattern

Builder pattern is used to construct a complex object step by step and the final step will return the object. The process of constructing an object should be generic so that it can be used to create different representations of the same object. For example, you can consider construction of a home. Home is the […]
Published to Creational Design Pattern Tutorial on 17/11/2009.

Abstract Factory Design Pattern

Factory of factories. To keep things simple you can understand it like, you have a set of ‘related’ factory method design pattern. Then you will put all those set of simple factories inside a factory pattern. So in turn you need not be aware of the final concrete class that will be instantiated. You can […]
Published to Creational Design Pattern Tutorial on 11/11/2009.