Review of two books on dependency injection and domain-driven design
2026-08-25
Every year I read a few technical I.T books. Usually based on what happens to be driving my interest at any one time rather than any special interest. This year I've floating towards some old classics. A couple books that have stood the test of time. I thought I'd give a quick review for each of them.
Dependency Injection: Principles, Practices, and Patterns by Steven Van Deursen and Mark Seemann
As the name suggests, Dependency Injection: Principles, Practices, and Patterns is about teaching the overall concepts of dependency injection in depth. Written back in 2011, the concepts taught are still relevant, and the case studies still problems today. I read the updated second edition released in 2019. Possibly this books biggest impact is the introduction of the SOLID Principles to the world. I wasn't aware of this at the time of reading and it was a nice surprise.
I enjoyed the writing style, made good use of metaphors, a lot of metaphors based on cooking that worked much better than one would think. The writing had a narrative feel to it, often switching to a fictional story of a developer getting advice on how to approach problems. This worked as a way to introduce 'common sense' but bad approaches or code smells vs perhaps less obvious but cleaner approaches assisted with dependency injection concepts. This assisted the explanations well, the writers did a good job in making both approaches seem reasonable, and justifying why they may be good or bad. I have personally been or seen many of these examples in my career and could relate. Perhaps this all worked because the explanations were just so well written in the first place, they were quick to the point without being confusing, and they avoided tangents.
Like Implementing Domain-driven Design which I'm also reviewing today, I went in already knowing most of the patterns and concepts being described. That shouldn't be surprising, this book is aimed at intermediate developers and I went in knowing this. However by the end of this book, I felt I ended up with a much stronger understanding of concepts, even those I am already strong on. There was even a few patterns I wasn't aware fell into the 'dependency injection space' such as method injection (to be fair, i didn't know it was called that). The advice is great regardless of experience, and a good reinforcement of concepts. It also goes a bit beyond dependency injection and covers a few useful architectual patterns.
The decision to dedicate most of the book to 'pure dependency injection' was a good one. By not focusing on any particular dependency injection framework, it stripped back dependency injection to it's very core basics. Technical books by their nature have a natural bias towards certain languages or frameworks, the writer has to pick a language for the examples, and preferences would be impacted by their day to day stack. By focusing mostly on pure dependency injection, the book was able to make the explanations agnostic as possible. They didn't first have the teach the concepts of their chosen framework and there was no need to filter out or understand framework specific boilerplate or thinking.
The examples are all in C#, but are kept small. Not much mental effort is needed to parse and understand them.
To sum up, Dependency Injection: Principles, Practices, and Patterns was very well written, and exceptionally readable. One of the best of it's type I have read. I would recommend it even those already comfortable with dependency injection.
Implementing Domain-driven Design by Vaughn Vernon
I picked Implementing Domain-driven Design because it is the 'red book' on domain-driven design, often considered a companion to Eric Evans earlier 'blue book' on the same topic.
Unfortunately I didn't enjoy this book as much as Dependency Injection: Principles, Practices, and Patterns so I will start with the good first. It's a very beautiful book, it feels and looks great. Not something I'd typically comment on often in book design, but this stood out to me. I don't mean this as a small complement to start a string of criticism either, it really is a stunning book.
The prose of the writing stuck me as exceptionally eloquent and at times beautiful but this is what leads to my core issues with the book. It is verbose, so verbose. Explanations are long and roundabout that it is often a struggle to find the point, or even if there was one. This is a six hundredish page book that could easily have been cut down by two thirds. This long windedness made the book frustratingly slow to read. An example that comes to mind, that contrasted quite strongly with the book above, would be it's section on Command-Query Separation (CQS). It is pages long - I went in already knowing the pattern and came out confused and questioning if I ever new it at all. Dependency Injection: Principles, Patterns, and Design in contrast dedicates two paragraphs to the concept, in a concise and easy to understand way - not much detail being missed out. CQS is a simple pattern to explain, it does not need a whole chapter dedicated to it. As a result I would consider this book to be for 'advanced' developers - it's difficult to follow for someone who knows what it's trying to say, someone new has no hope.
I Was surprised about how many of the patterns and strategies in this book are mainstream and common now. Many of which might not even considered distinctly domain-driven design. E.g the afore mentioned CQS pattern.
There were also some odd approaches used in this book. An example is the uses of a bad code before giving the good code approach for all of it's examples and many explanations. I personally found this difficult to follow since often we didn't yet have the context to spot for ourselves why the example is bad in this case. Dependency Injection: Principles, Patterns and Patterns also often gave bad approaches first, but always after explaining the right approach first. In those examples it was clear it was wrong, we had context, while in this book I had to spend a lot of mental energy to figure it out. Perhaps the issue here is the code examples were simply difficult to read? The examples here all used Java specific frameworks like Hibernate.
I wouldn't recommend Implementing Domain-driven design. I have since learnt of another book called Patterns, Principles, and Practices of Domain-driven Design (I'm noticing a theme in book naming) which I have heard covers many of the same concept as this book, but much more concisely. I read this book because I wanted to reinforce my understanding of domain driven design and I feel it did not do that. Perhaps this new book may help with that instead?