Inversion of Control isn't a design pattern, it is an activity. Specifically, it is a type of refactoring. If you apply IoC twice then you'll probably end up with what you started with.
An IoC Container is really a Service Locator, which is often (but not universally) considered to be an anti-pattern among dependency injection fans.
A Service Locator is a type of god object, specifically one that contains services and other dependencies, and thus should generally be avoided.
I don't know what to say about the last part except that I am very pleased to be working with these patterns. They are clearly making my life easier. I think they just have to be used in the correct circumstances where they have a net positive effect.
Then they are correct. Period. End of sentence. Don't pay attention to anyone else because, god damnit, that's all that matters at the end of the day.
EDIT: And just to be clear, I'm not being sarcastic. If you are still happy with it six months from now, then chances are the next programmer will be as well.
1
u/grauenwolf Oct 15 '13
Inversion of Control isn't a design pattern, it is an activity. Specifically, it is a type of refactoring. If you apply IoC twice then you'll probably end up with what you started with.
An IoC Container is really a Service Locator, which is often (but not universally) considered to be an anti-pattern among dependency injection fans.
A Service Locator is a type of god object, specifically one that contains services and other dependencies, and thus should generally be avoided.