Design Patterns - Decorator Pattern

Posted Sunday, June 29, 2008 9:42 PM by CumpsD

Following up on the Observer/Event Pattern, it’s time for the third pattern, the Decorator Pattern.

The definition: "Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality."

Decorator Pattern

Read more at http://blog.cumps.be/design-patterns-decorator-pattern/

Comments

# re: Design Patterns - Decorator Pattern

Monday, June 30, 2008 12:01 AM by Sameera

C&C fan?

:)

# re: Design Patterns - Decorator Pattern

Monday, June 30, 2008 2:08 PM by CumpsD

I wanted to add the Obelisk of Light (NOD), but feared not that many would understand it :p

I played all C&C games probably, from the very first DOS one ;)

# re: Design Patterns - Decorator Pattern

Wednesday, July 02, 2008 1:20 PM by Sameera

Same here ;)

Still couldn't get around to play Tiberium Wars though :(

# re: Design Patterns - Decorator Pattern

Thursday, July 03, 2008 4:26 AM by Paul Kinlan

Hi,

Nice example.  Although I thought it was slightly confusing by BuildingLaser being above BuildingUpgradeDecorator, but that is probably me missing the direction of the generalisation.

Also the IBuilding label is missing from the Normal Building.... Your other site mentions it though! :)

Paul.