Completing an Algorithm

As in the ADAPTER pattern, a thoughtful developer may foresee that you have a role in completing his or her design. In ADAPTER, you supply an object that responds to the needs of the other developer's code. In TEMPLATE METHOD, you supply a step of an algorithm.

Consider the Aster star press that Figure 21.2 shows. A star press from Aster Corporation accepts empty metal molds and presses fireworks stars into them. The machine has hoppers, not shown in the diagram, that dispense the chemicals that the machine mixes into a paste and presses into the molds. When the machine shuts down, it stops working on the mold in the processing area, and ushers any molds on its input conveyor through the processing area to the output, ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.