I'm busy playing around with some training material to help teach some of the juniors the factory pattern.
Whilst writing the example, I can't help but think this might be an anti-pattern.
Lets say I have
iVehicle which is implemented by
iMotorVehicle which, subsequently is implemented by
Would it be considered an anti-pattern to call a
VehicleFactory, whose sole responsibility is to produce a resultant of
iVehicle which will then call the
iMotorVehicle to call the
CarFactory to produce a result of
To me this feels like each of the factories are fulfilling their respective responsibilities without stretching to fulfill a responsibility that could be fulfilled by another.
Is this an anti-pattern?