Poor man’s DI is dead; long live Pure DI

! Warning: this post hasn't been updated in over three years and so may contain out of date information.

One of the last posts I wrote before disappearing off the face of this blog for nearly two years was “Are IoC Containers a case of ‘The Emperor’s New Clothes’?” there were two main points that I was exploring in this article that bugged me at the time:

  1. All too often, people seem to come up with dreadful implementations of IoC that either exposed all of their application to the container or they used some sort of “God object” container to handle injection into every part of the application.
  2. The way to avoid the above problem was given the rather insulting term “Poor Man’s DI”, which was unhelpful as it naturally discouraged those learning about DI from using it.

The first point was adequately covered by the article and I won’t go back over it here. Since I wrote that article an important development regarding “Poor Man’s DI” has occurred and that warrants a new post on the subject. It occurred six months after I posted, so it’s old news, but I only learned about it recently. In April 2014, Mark Seeman, the man I criticised for using and endorsing the “Poor Man’s DI” term, posted an article entitled “Pure DI”, which he proposed as a replacement term. This is great news in my view. Not only is it more positive in tone, it’s a far more accurate description.

I’d therefore like to publicly issue Mark a “thank you” for this shift in his thinking (hopefully my post played a small part in causing this change). Pure DI is an essential part of any DI solution, whether an IoC container is used or not and the new positive term should help promote its use. Cheers, Mark!