Monday, March 23, 2009

Dependency Injection, is it for you?

People have been trying to convince you how great Dependency Injection is. Maybe they're calling it Inversion of Control. Either way, you're not buying it.

If you haven't been able to see the benefit, try reading Justin's blog post: To Inject or Not To Inject (warning: it is long, but worth it).

Justin focuses on complex configuration scenarios, but I like to recommend DI for its reusability. Self-configuring and "service locator" configuring tends to constrain you to using a particular type of configuration infrastructure, making it difficult to reuse your components, not to mention unit testing.

No comments: