Dependency Injection in One Sentence

  • Posted By Stuart Halloway on August 01, 2007

Jim Weirich has dared people to define Dependency Injection in One Sentence. Here goes:

Dependency injection is a palliative for environments that unnecessarily couple creation, lookup, and interaction between collaborators.

Comments
  1. Jeff WhitmireAugust 01, 2007 @ 07:20 PM

    Wow, fascinating use of the word palliative. So what might you suggest would be the real cure to the problem of unnecessary coupling? Personally I hope to never work in a tightly coupled environment again, but should that happen I would think that DI would be a good thing so there is a common framework for alleviating said coupling.

  2. StuAugust 02, 2007 @ 01:11 PM

    I think that unnecessary coupling often comes at the platform level, so the cure is to fix the platform. DI is a good thing, but it is a palliative: Using DI on a project doesn’t cure my platform—I have to use DI again on the next project.

  3. Jeff WhitmireAugust 02, 2007 @ 07:45 PM

    Well said. Love the quote, by the way.