Sections

Python · Section 33

Dependency Injection

Depending on abstractions instead of concrete classes, the two ways to pass a dependency in (constructor and function injection), containers that automate wiring, the FastAPI Depends() pattern, and why all of this is what makes a class testable in isolation.

This section
  1. Dependency InjectionWhy a class should depend on an abstraction rather than a concrete class, the two ways to hand a dependency in (constructor and function injection), a container that automates wiring several dependencies together, the FastAPI Depends() pattern, and the testing and hidden-state problems dependency injection actually solves.4 core3 standard7 concepts