I understand what IoC containers are and have been reading up on Structure Map. The technology seems easy enough to use. My question is, what is the appropriate level of granularity for using an IoC container?
I see the following possible levels of application for IoC:
- Break every dependency between all objects - certainly overkill.
- Break dependencies between all major objects such as domain objects, support classes, and components within subsystems.
- Use IoC in conjunction with a Facade to wrap a subsystem (such as logging) with a public interface and then break the dependency on that interface.
I know the answer to this question is "it depends", but from your experience, what does then answer depend on? Is project size a factor?
Furthermore, where doesn't IoC make sense to use?