Last post Aug 24, 2011 11:37 PM by castlehills
May 05, 2011 09:12 AM|castlehills|LINK
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?
May 05, 2011 04:00 PM|abhisheks|LINK
From my experience, it's really a matter of choice and the team you are working with. IoC containers gives you built in framework to create the object and dependencies, and with factory patterns you are basically doing it yourself. In software development,
there is nothing called the silver bullet right approach. The right approach is everything in development should be visible and understanble to the team that has to maintain the application in future. It should be understandable to the new developers joining
your team, they should be able to ramp up with your organizational approach to coding.
Team members you are working with may not be familiar with IoC containers framework and so really team members may not be willing to go through that learning curve.
With any third party framework, there is always that dependency where newer versions are sometimes not compatible with old ones, or may be there's some extra work to get the existing system to work from the upgrade.
These are really not cons if you think about the time you can save by using those third party frameworks, usually problem lies in the fact, there's no well defined process at the executive level as to how to tackle those issues.
Jul 10, 2011 02:06 AM|anshuman_s200|LINK
You can answer all the above questions for your self if only you understand the fundamentals of IOC an DI. This concepts are rediculously simple at their heart. The following link explains IOC and DI in extremely simple way
Let me know if you have furthur questions.
Aug 24, 2011 11:37 PM|castlehills|LINK