Monday, 23 April 2007

Decorator Pattern

Decorator Pattern:
The Decorator Pattern is used for adding additional functionality to a particular object as opposed to a class of objects. It can be easy adding functionality by entire class objects of by subclassing an object you can try single objects this way and leave other like unmodified. Also decorator pattern is known as wrapper which the object interface identical to an object decorator can add and remove object without client realizing Decorator in a situation where you want to change the behaviour of an object repeatedly (by adding and subtracting functionality) during runtime.


Reference:

http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/DecoratorPattern.htm

4 comments:

GillesdeBiaks said...

Hello,

I have found your description (definition) about the Decorator Pattern simple and clear to understand. At least you could also go in deep for experienced (engineered) people in Design Pattern. Thanks for that.

Rizwan Khan said...

Hi
I find you description very brief and not explainatory. Sorry but it doesn't make sence when you say 'try single object this way, can do single...'

Asmat Ali said...

GillesdeBiaks, I agree and respect your comment.

You must have wrote a very good blog about Decorator Pattern but that is too long to read and which was the main reason, I skipped and wasn’t able to comment on that.

I follow the technique of keeping them short and simple.

Asmat Ali said...

rizwan khan, I totally agree that its brief but I don’t think it’s not explanatory because it clearly describes the logic of Decorator Pattern. You can surely add more on top of it but it will be the same thing again with some further details.

I don’t understand the part of comment: 'try single object this way, can do single...' What are you actually talking about?