Refactoring to Bridge
Sometimes, you have to refactor an abstract class into a BRIDGE to gain more flexibility in the abstraction. Consider the MachineController hierarchy at Oozinoz. Other than database drivers, the most common application of drivers is to operate external devices. These devices may be peripherals, such as printers and pen plotters, or any machine capable of communicating with computers. Applications at Oozinoz control most of the machines on the factory floor with the drivers, or controllers, that Figure 6.4 shows.
Figure 6.4. Instances of classes in the MachineController hierarchy drive machines in the Oozinoz factory.
The ...
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.