Java Reference
In-Depth Information
class, you may be able to apply the Template Method (Chapter 21), Command (Chapter 24),
Decorator (Chapter 27), or Visitor (Chapter 29) design patterns.
Ordinary extension also adds behavior to individual instances of a class. You may need to add
behaviors that apply to a collection of instances of your class. The I TERATOR pattern
addresses one such case.
If you intend to
Apply the pattern
Allow a client to hook in an operation at a step in an
algorithm
Let a client outfit your code with an operation to execute in
response to an event
Attach additional responsibilities to an object dynamically
Provide a way to access a collection of instances of a class
that you create
Allow for the addition of new operations to a class without
changing the class
Template Method
(Chapter 21)
Command (Chapter 24)
Decorator (Chapter 27)
Iterator (Chapter 28)
Visitor (Chapter 29)
Extension-oriented patterns address contexts in which you need to add behavior specific to
a collection of objects or to add new behaviors to an object without altering the object's class.
For example, when you need to be able to add new behavior to an object dynamically, you
can apply the D ECORATOR pattern.
Search WWH ::




Custom Search