Decotator Pattern – Object Structural


Attach additional  responsibility to an object dynamically. Dcorators provide flexible alternative to subclassing for extending functionality.

Also Know As : Wrapper


Sometimes we want to add responsibilites to individual objects, not to an entire class.


Use Decorator:

  1. To add responsibilties to individual objects dynamically and transparently, that is without affecting other objects.
  2. For responsibilities that can be withdrawn.
  3. When extension by subclassing is impractical.



Decorator pattern
Decorator pattern structure






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s