Java Reference
In-Depth Information
Figure 6.6 shows the MachineController hierarchy refactored into a bridge. Fill
in the missing labels.
Figure 6.6. This diagram, when complete, will show the results of refactoring
MachineController to apply Bridge.
After this type of refactoring, you can usually change the declaration of the abstract superclass
to be a concrete class . Note, however, that the class is still an abstraction in that its
operations depend on the implementation of abstract operations defined in the interface.
A Bridge Using the List Interface
Drivers offer good examples of the B RIDGE pattern, but you can apply B RIDGE in other
situations, too. Whenever you separate an abstraction—a class that relies on a set of abstract
operations—from the implementation of its abstract operations, you have applied B RIDGE .
Consider the Queue class in use at Oozinoz. When using a list to model a conveyor, you have
discovered that it is easy to get confused about which end of the list applies to which end of a
conveyor. To avoid this confusion, Oozinoz developers always define the ends of the
conveyor as the conveyor's tail and head and define that the belt moves from the tail toward
Search WWH ::

Custom Search