Dependency injection links

I noticed about two dozen eyes glaze over last night when Ben started talking about dependency injection. 

This stuff rocked my world when I started understanding it.  Things I used to worry about are non-starters now, and I've been freed to worry about what I should have been worrying about all along. By that I mean I am able to write good code because decoupling my objects doesn't have a complexity penalty. It's quite liberating.

 I had a chat with someone who has been helping me go like this: 

11:39 AM me: if i have SearchService use another repository (say, IProductsRepository).... it's cool to just add a parameter to the constructor? seems to be
11:40 AM XXX: yes, structuremap will build it for you
11:41 AM me: just to make sure i am getting this right: there is no value in overloading the constructor, and there is no worry about having too many parameters since DI is used.
11:45 AM XXX: yeah, you got it
11:46 AM me: freaky

 Here are some starting points to get up to speed.

You might want to go over the Windsor getting started walkthrough.  Here, Inversion of control isn't used in exactly the same way it was demonstrated last night, but you can get acclimated to the techncial capabilities of a container. 

There's a ton of info at BitterCoder's Windsor Wiki and more in a great article from Simone Busoli.  You can also surf the list of popular posts tagged ioc on del.icio.us (which always has great information about a given topic)...

Besides Windsor, there are other containers for .NET:  StructureMap, Spring.Net, and ObjectBuilder

 

Published Wednesday, January 16, 2008 6:33 AM by mhinze

Comments

No Comments