When to use an IOC container?

Posted by nivlam on Stack Overflow See other posts from Stack Overflow or by nivlam
Published on 2010-03-31T06:58:44Z Indexed on 2010/03/31 7:03 UTC
Read the original article Hit count: 734

I'm trying to understand when I should use a container versus manually injecting dependencies. If I have an application that uses a 1-2 interfaces and only has 1-2 concrete implementations for each interface, I would lean towards just handling that myself.

If I have a small application that uses 2-3 interfaces and each interface has 2-3 concrete implementations, should I use a full-blown container? Would something something simple like this suffice?

Basically I'm trying to understand when it's appropriate to manually handle these dependencies, when (or if) I should use something simple like the above, and when to use an IOC container like Ninject, Windsor, etc....

© Stack Overflow or respective owner

Related posts about inversion-of-control

Related posts about dependency-injection