As everyone knows, the factory pattern and service locator help to create an object and it's dependencies. Then we have IoC containers like Unity with the same motive. Can we discuss which is the right approach?
The pros of a factory pattern is that, there is involvement from the developers to create new dependable objects. The cons is that you have an extra layer in the application to just handle the dependencies.
The pros I see of both service locator and IoC is that you can approach the dependencies more as configurations - you are setting up the dependencies. No new layer in the application is needed. The cons may be the passive approach to development as you see in "don't call us, we'll call you".
Can we discuss?
View Complete Post