What is the real difference between “Bastard Injection” and “Poor Man’s Injection”

When it comes to DI, there’s a lot of conflicting use of terminology out there. The term Poor Man’s DI is no exception. To some people, it means one thing and to others it means something different.

One of the things I wanted to do with the book was to supply a consistent pattern language for DI. When it came to all of those terms with conflicting use, I had two options: Come up with a completely new term, or pick the most prevalent use (according to my subjective judgment).

In general, I’ve preferred to re-use existing terminology instead of making up a completely new (and thus alien) pattern language. That means that in certain cases (such as Poor Man’s DI), you may have a different notion of what the name is than the definition given in the book. That often happens with patterns books.

At least I find it reassuring that the book seems to have done its job of explaining exactly both Poor Man’s DI and Bastard Injection, because the interpretation given in the O.P. is spot on.

Regarding the real benefit of a DI Container I will refer you to this answer: Arguments against Inversion of Control containers


P.S. 2018-04-13: I’d like to point out that I’ve years ago come to acknowledge that the term Poor Man’s DI does a poor (sic!) job of communicating the essence of the principle, so for years, now, I’ve instead called it Pure DI.


P.P.S. 2020-07-17: We removed the term Bastard Injection from the second edition. In the second edition we simply use the more general term Control Freak to specify that your code “depend[s] on a Volatile Dependency in any place other than a Composition Root.”

Leave a Comment