aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Decorator pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Decorator pattern" Watch "Decorator pattern" New topic
Author

Decorator pattern

Priya Bindra
Ranch Hand

Joined: Sep 22, 2009
Posts: 51
I dont understand how decorator pattern is different from sublassing.

Wiki says that: "The decorator pattern is an alternative to subclassing. Subclassing adds behaviour at compile time, and the change affects all instances of the original class; decorating can provide new behaviour at runtime for individual objects."

Can someone explain.
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
This link should help you
webpage

SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
EJB deployment descriptor adds beans behavior at run-time using decorator design pattern. Inheritance adds behavior during compile time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Decorator pattern