
My good friend Dhanji Prasanna from Google recently finished his book on DI practices and patterns. I was given a copy for review - I am by no means a DI expert (barely know what it is).
To be honest I am/was a DI skeptic, I view it as a way to make up for weaknesses of statically typed mainstream languages (such as C# or Java). And thus DI brings in a raft of type unsafety issues, leading to runtime hassles (without the productivity/joy of a dynamically typed or scripting language).
However, the book always circles back to how to solve a problem in a type safe way - were code is more correct (and the compiler verifies it) before any runtime error occurs (any runtime DI activity is for performance and functional) - and leads to less surprises and biting in the ass.
The style of the book seems to be to show the problem in its raw form, using various tricks to try and get around it, failing and then introducing a DI framework, and showing the various solutions with the framework. Each section usually resolves to a simple solution that provides compile time type safety - I can reasonably assume this is Dhanji's intent, to gently "show you the way" - ie "the right way" of doing it. Dhanji is a Guice committer, so of course the best side of Guice is shown, but I believe he also does the best with the other frameworks he has a lot of experience with (personally I admire Guice a lot, I think it has learned from all the frameworks before it and been battle hardened).
Well if you do large scale java apps, you probably want to have someone on the team have this book.
