Great IoC and DI Articles
I’ve been interested in learning more about Inversion of Control (IoC) and Dependency Injection (DI) containers for awhile now, so I decided to take a look.
My interest was piqued by an article by Mark Seemann from his upcoming book “DI in .NET”. This was a good introduction, but not very in-depth – I’m certainly looking forward to his book now.
After digging in more, I discovered a few more good articles (also on .NET Slackers) that explain IoC and DI using the Castle Project – “Inversion of Control and Dependency Injection with Castle Windsor Container” – check them out:
Very cool stuff.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
December 10th, 2009 at 3:40 am
Hi Matt,
Have you ever seen the Common Service Locator project? http://commonservicelocator.codeplex.com/. In itself it’s not a DI framework, but it’s a shared interface for plugging in DI frameworks.
Cheers
December 10th, 2009 at 10:56 am
Oh wow, thanks a bunch Steven. That looks great – I’ll definitely check it out. Have you used it?
December 11th, 2009 at 8:04 am
I haven’t been able to use it in a production setting yet, but I’ve already advised some of my customers to place their home grown IoC libraries behind the CSL facade.
What’s nice about the CSL is that it is created in collaboration with people from the major IoC frameworks.
There are however still some things that has to be sorted out. Look for instance at this discussion I started: http://commonservicelocator.codeplex.com/Thread/View.aspx?ThreadId=77730. Next to that there are some minor issues, like this one: http://commonservicelocator.codeplex.com/WorkItem/View.aspx?WorkItemId=9676.
January 12th, 2010 at 12:41 pm
FWIW I consider Service Locator to be an anti-pattern, since it is totally opaque to the user of the API which dependencies need to be in place; thus, one could easily invoke methods on objects in a context where the Service Locator would throw, and the API gives you absolutely no clue that this is the case.
Much more about that in my book
With that in mind I consider the Common Service Locator redundant at best. Personally, I would never take a depedency on it.
January 12th, 2010 at 12:48 pm
Thanks, Mark.
I did notice your discussion about the Service Locator (anti)pattern in your upcoming book (MEAP Ch 5).
This brings up some very interesting points. I need to dig in and learn more.