Part 2. DI catalog

 

Part 1 provided an overview of DI, discussing the purpose and benefits of DI and explaining how DI CONTAINERS fit into the overall picture. Even though chapter 2 contained an extensive example, I’m sure the first chapters still left you with some unresolved questions. In part 2, we dig a little deeper to answer some of those questions.

As the title of part 2 implies, this is a catalog of patterns, anti-patterns, and refactorings. Some people dislike design patterns because they find them dry or too abstract. Personally, I love patterns because they provide us with a high-level language that makes us more efficient and concise when we discuss software design. It’s my intent to use this catalog to provide a pattern language for DI. Although a pattern description must contain some generalizations, I’ve attempted to make each pattern concrete, using examples.

You can read all three chapters in sequence, but each item in the catalog is also written so that you can read it by itself.