Tuesday, February 21, 2012

Thoughts about Dependency Injection

I just discovered, that a quote of me made it to the cover of Dependency Injection in .NET:

Looking at the book in its final form, I am surprised at how well that quote fits my current thoughts.

I like the style of the author. This stackoverflow answer is just a nice example of his style: dependency injection can be dangerous for your career.

A quote from my original review of the manuscript:
This is one of the best programming books I have read in the last three years. I like about everything in this book. The technical insights. The way  it focuses on concepts and not on tools or technologies. [...] It is definitely suited for programmers that want to learn good design and development techniques. It is not a reference book for a technical framework.

However I have a problem with the hype of dependency injection in general. It definitely goes into the direction of accidental complexity. I mean 584 pages, is a bit heavy for a promise to get better internal quality ... given I do everything else right. Especially compared to other, much wider topics that can have a much broader impact on your development:

From this perspective "All you need to know ... and more!" fits quite well: You will learn a lot reading the book, but it is sad that the current state of software development is that loaded with accidental complexity so that you have to be concerned with that much non-essential overhead ...

I also recommend reading a real critique of the current state of dependency injection: "Dependency Injection" Considered Harmful


  1. > I mean 584 pages, is a bit heavy for a promise to get better internal quality ...
    The better internal quality takes more about 311 pages. The rest of the book compares serveral DI containers.


  2. Considering you link to Nat Pryce's article, isn't it more a "Dependency Injection Frameworks|Containers considered harmful"?

  3. @Giorgio: Of course ... that's part of the accidental complexity in my opinion: Dependency Injection is equivalent to using a framework today...


Related Posts Plugin for WordPress, Blogger...