Hi.
I am learning design patterns and I don;t understand the Decorator pattern, can anyone please explain it to me or link me to an article about it.
an example when to use it and why would be great.
thanks.
Printable View
Hi.
I am learning design patterns and I don;t understand the Decorator pattern, can anyone please explain it to me or link me to an article about it.
an example when to use it and why would be great.
thanks.
Google is your friend :) Type in "Decorator Pattern"... click search... VOILA! Plenty of hits on the first page :p
I didn't Google, so I'm not sure what you'd find, but it's easy to get lost and/or get a technical explanation without really understanding what the heck a pattern can be used for in the real world.
If you're just starting out learning patterns, I recommend the book Head First Design Patterns from O'Reily. Its really an excellent book, in more ways than one. The decorator pattern is explained in detail, with excellent examples or why you'd use that pattern rather than subclassing.
The Head First series comes from the Java world, but there's very little Java code in there, and design principles apply to any object orientated language.
Anyway, buy the book. It retails for about $45. Well worth the money. I've got literally thousands of dollars of software books, and this is one of my favorites.
Mike
Hi,Quote:
Originally Posted by dorraba
Found a link via Google like gigemboy suggested.
See this link:
http://www.castle-cadenza.demon.co.uk/decorate.htm
Hope it helps for your explaination.
sparrow1
Hi Dorraba, I highly recommend "Addison Wesley: C# Design Patterns, A Tutorial", you can find it searching in the emule the CHM and the examples both in C# and VB.net.
Regards,
Tribo
Here is one more - specifically for the Decorator pattern with example code:
http://www.dofactory.com/patterns/Pa...or.aspx#_self2