Need suggestions for my design. Am I using Factory and Impl classes properly?
Posted on 2011-10-11
In my 2d simulator I have a CargoTruckImpl, which is spawned from the TruckImplFactory (that was called by the CargoTruck class), asking the MovementImplFactory for it's CargoTruckMovementImpl. And then I also have a FuelTruckImpl doing the same thing by calling the MovementImplFactory for it's own FuelTruckMovementImpl. So basically I'm doing the following:
Is this a good or bad design? Am I violating the Seperation Principle or the Open-Closed Principle by doing this? Is there a better way of doing this?
I would prefer a thoughtful conceptual answer. No quick posting or links please.