After the class, i did some research on the decorator pattern and ii find out that its one of the most important of the 23 pattern types. Some of the reason why i said its important is that is flexible and you can do what ever you want to do with it. that is why i come up with this defination of decorator pattern.
Decorator pattern is the design pattern that allow additional or new behavious to be added to an existing design dynamically.
The example i can give for easy understanding of a decorator is, when you go to a chinese restarant to buy food, you can buy your rice and as them to add some aditive food to it, like chicken wing, ribs, soup and so on. So all the ribs, chicken wing and soup are all decorator.

REFERENCES
http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/DecoratorPattern.htm
1 comment:
Hi samual
Your definition is correct, but the example seems a bit out of track, in your example, the initial rice you get is your main object, while the added foods are added functionalities, I could not find out who plays the role of the decorator, hope you would eloborate on that
Best of luck
Post a Comment