Java Reference
In-Depth Information
EXERCISES
1.
Extend the shop example given earlier by adding more discount decorators and introducing
more qualii ers to gain i ner control over which decorators are invoked for which concrete
implementations.
2.
Implement the decorator pattern on an existing API to add new functionality.
For example:
java.io.FileInputStream.
3.
Create a decorator that adds behavior to a bank account system such that when the client
withdraws more than a certain amount of cash, an SMS text message is sent to the client
advising of the withdrawal.
NOTES
1.
Design Patterns: Elements of Reusable Object‐Oriented Software
(Addison‐Wesley, 1994):
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides.
2.
Head First Design Patterns
(O'Reilly, 2004): Eric Freeman, Elisabeth Robson, Bert Bates,
Kathy Sierra.
3.
Pyro:
http://muse.com.tr/pyro.html.
4.
CDI Specii cations 1.1:
http://docs.jboss.org/cdi/spec/1.1/cdi‐spec