The Command pattern
“There is one last refactor I want to make. You used the Command pattern to direct the manufacturing robotics to build your bicycle. Naturally, I want to use the same manufacturing system. I think the differences can be easily handled,” Tom said.
“OK,” Phoebe said quizzically with one raised eyebrow. “What are you doing to my babies?”
Tom dragged some classes to the diagram and arranged them to form the Command pattern. Once he got everything filled in, his diagram looked like this:
Figure 6.25: Tom’s change to the Command pattern is fairly minor
Tom said, “We need to make a change to the DoBusinessLogic method in AssemblyLineReceiver. You have it set up to only take one interface: the IPaintableBike interface. I can’t force-fit my wheelchair to be a paintable bike. We could change the central interface for my project from IMobilityDevice to IManufacturable.” He...