Learning Dependency Injection

I recently accepted a new job, its one of those jobs where everything matches your skillset, technical interests, personal home/work balance requirements, and ethical requirements. I am super excited to be working here. While I have many of the skills required for the position they are doing some things I have never done before. One of them is that they use Dependency Injection (DI) with Unity and nHibernate. I have heard of them but never looked into them before. Here is the approach I took to learning this new skill set, I had 2-3 days to figure it out before the work would start rolling in.

Step 1: Talk to my co-worker who is the project guru
First I spoke to my coworker who gave me a general overview of the system and how things are laid out, setup, and interwoven. During the overview he mentioned that it would be good if I knew more about DI before getting to deep into the code.

Step 2: Google
My next stop was Google where I found the following blog posts and websites that had some information that helped. It wasn’t enough. Because I don’t understand the basics I was completely confused.
Dependency Injection and Inversion of Control with ASP.NET MVC
ASP.NET MVC 3 Service Location, Part 1: Introduction
MSDN: Appendix A – Dependency Injection with Unity
Microsoft patterns & practices: Unity
Microsoft patterns & practices: Inject Some Life into Your Applications—Getting to Know the Unity Application Block

Step3: StackOverflow
Next I went to StackOverflow to try again.  I started looking at the posts in the dependency-injection tag and found the following gems. 
Learning inversion of control through dependency injection in MVC3
Dependency Injection book recommendations
How to explain dependency injection to a 5 year old

Step 4: Resorted to a Technical Book
In a StackOverflow post I finally found a reference to the book “Dependency Injection .NET” by Mark Seeman. Luckily the publisher has the first chapter of the book available for free on their website. Things are finally beginning to make sense. 

Step5: Book – Dependency Injection .NET
I finally just broke down and purchased the book and started to read it.  Some of it makes perfect sense and some just makes my head hurt.  I am glad I got it and find it to be very useful.  I like that it has great examples and a section on patterns. 

Step 6: Talk to my co-worker who is the project guru
Now that I have read and understood enough of the book to get the basics I will be having my coworker go over the whole thing again, in more depth this time.  Hopefully I can hit the ground running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s