Tuesday, July 01, 2008

Dependency Injection Resources

Here are the promised resources:

The Single Responsibility Principle by Robert C. Martin (Uncle Bob) is one of the design principles that makes Dependency Injection useful.  Also recommend are his articles Open/Closed Principle; Dependency Inversion Principle; and Liskov Substitution Principle.  All of these articles are more or less excerpts from his book Agile Principles, Patterns, and Practices in C#, so if you are interested in his book (which is great) these articles would be a good place to start before you make the investment.  Remember there is a Java version of the book too (Agile Software Development, Principles, Patterns, and Practices).

Unfortunately due to the structure of my talk I gave these principles short-shrift, so I want to make myself clear while I have the chance:  I consider them to be more important than the tool (the container).  In fact, I suspect that if you aren't following SRP, OCP and DIP, a Dependency Injection container would be useless anyway.

While I'm on books, Refactoring: Improving the Design of Existing Code is a must have title.  This is the book I mentioned in the talk that I bought years after having it recommended.  It was too bad I waited, because the book was a revelation.  Just the chapter on Code Smells alone is worth the price of admission.

The Castle Project's home page is a link worth having.  There are some tutorials worth looking at here if you want to go deeper.  Note that the Castle Project is a lot bigger than just the MicroKernel and Windsor Container - it also boasts the Monorail project (a .NET MVC web framework) and a really cool Dynamic Proxy.   Great stuff.

Using Castle Project is a collection of Castle Windsor specific resources. 

I'm not actively using StructureMap right now, but they just had a new release that is probably worth looking at.  They also have a NAnt task for testing configuration, which is a really cool addition.

High-Level Concepts is a part of the StructureMap web site which gives some great summaries of concepts surrounding good design in general, and Dependency Injection in particular.  These are important regardless of which container you use.  It was written by Jeremy Miller, who's blog is a great resource no matter what he's talking about.

The IoC mind set: Validation is a pretty powerful article by Oren Eini on how to use a Dependency Injection Container (Castle in this case) to manage a multiplicity of validation rules.  It addresses a point I had hoped to make with my final example but which got lost in the lack of time and the broken code.  The container permits some *very* interesting efficiencies, that you just wouldn't come up with if you didn't have a container.  It is what Oren calls the Inversion of Control Mind Set in this entry.

I'd recommend subscribing his blog if you really want to stretch your mind in this direction.

ALT.NET Portal is a good place to start for exposure to all of the ALT.NET stuff, not just Dependency Injection.  The discussion groups on Yahoo are pretty rich.

Inversion of Control Containers and the Dependency Injection pattern is Martin Fowler's article on the topic.  It is usually the first citation when someone covers this topic.  It examines an alternative pattern as well - Service Locator.

Again, if any of you want further assistance with this stuff, call or email me and I'll be glad to help.  Thanks again for attending!

No comments: