Design Patterns Java™ Workbook

(Michael S) #1
Appendix B. Solutions

Figure B.17. The constructors in the MachineComponent hierarchy support the rules
that a MachineRoot object must have a responsible engineer, and every
MachineComponent object except a root must have a parent.

SOLUTION 12.5....................................................................................................................................


Two examples of when CHAIN OF REPONSIBILITY might apply to objects that do not form
a composite are



  • A chain of on-call engineers that follows a standard rotation. If the primary on-call
    engineer does not answer a production support page in a specific amount of time, the
    notification system pages the next engineer in the chain.

  • When users enter such information as the date of an event, a chain of parsers can take
    turns trying to decode the user's text.

Free download pdf