CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 1 of 6 · 1 min read

Why this page comes last in Level 3

In this module you will

  • Define dependency injection (DI) and say what it is not.
  • Write constructor injection for a service with three dependencies.
  • Build the object graph in one place, the composition root.
  • Inject a supplier when a class needs to create objects itself.
  • Replace real dependencies with fakes in a test, and say when a framework helps.

Modules 1 to 5 covered ways to make objects. This page covers the habit that decides where all that making happens. It ties together Level 2, module 5 (depend on abstractions) and module 4 of this level (the singleton problem). The sources are "Effective Java" (EJ) Item 5, "Clean Code" (CC) chapter 11, and "Clean Architecture" (CA) chapter 11. Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.