
Foreword
My first experience with Dependency Injection was almost 10 years ago. I was working at an ISV (independent software vendor) as an architect on an enterprise framework building LOB (line-of-business) applications. In those days, it seemed like all my friends in the industry were building similar frameworks. The framework supported various layers across n-tier applications addressing data access, business, and UI concerns. The product-supported business objects could be persisted across multiple databases and represented in multiple UIs; the challenge was finding a way to build the system to make it extensible and maintainable. We found our answer by wading into the waters of Dependency Injection. Using a DI approach, we clearly defined contracts for the layers, allowing us to more easily test the layers as well as to swap their implementations without breaking the code.
Mark talks quite a bit in this book about “poor man’s DI” and this is exactly what we were doing. In those days, we didn’t have DI containers at our disposal. We also didn’t have the type of guidance you’ll find in this book. As a result, we made a lot of mistakes—mistakes you won’t have to make.
In the past four years, I’ve personally worked with hundreds of customers and I’m aware of thousands that have found success using the techniques described in this book.
It all starts with patterns.