I am confused about which pattern to use to design the following scenario,
Interface GearBox { int upshift(); int downshift(); int reverse(); } AutoGearBox implements GearBox{...} ManualGearBox implements GearBox{...} Now I want to add DualClutchGearBox to the hierarchy.All previous gearboxes are single clutch. How do I go about doing it?
With Decorator -->
DualClutchDecorator implements GearBox{ DualClutchDecorator(GearBox box){...} } With Bridge -->
GearBox{ GearBoxImpl impl; .... } AutoGearBox implements GearBox{...} ManualGearBox implements GearBox{...} abstract class GearBoxImpl{} SingleClutchImpl extends GearBoxImpl{...} DualClutchImpl extends GearBoxImpl{...} Which is one is better and why?
DualClutchGearBoxneeds to be different fromGearBox.