Decorator pattern keywords

#1 key phrase:
java.io — uses decorators. P100 [[ head first design patterns ]]

hasa AND isa — at the same time. MyDecorator instance both HAS-A and IS-A MyDecoratee

Adding features — decorating, while adhering to original interface ie IS-A. MyDecorator.java often adds non-private[1] fields and methods to fulfill the duty of decoration.

Onion — “decoratee” could be abstract or concrete (onion) or an
interface. This onion is very similar if not the same as the RAM-onion
described in other blog posts. P89 [[ head first design patterns ]]

collections Synchronized view — of HashMap is adapter or decorator? I
would say Decorator — interface not changed.

complexity — Compared to straight HAS-A or IS-A, Decoration adds
complexity^flexibility. Due to the added complexity, decorate only
when warranted.

[1] Private /memebers/ are insigificant in this and many patterns.
Private members are invisible to other objects.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s