Chapter 5: Dependency injection
June 24, 2025 ยท View on GitHub
This chapter explores how to decouple code from its dependencies to improve testability and maintainability.
Topics covered
- Exploring challenges to testability
- Improving testability by isolating dependencies
- Using dependency injection techniques for testability
Sections
Section 1: Challenges to testability
- This section has no listings.
Section 2: Testable programs
Section 3: Decoupling
- Listing 5.2: Refactoring the
mainfunction - Listing 5.3: Setting
FlagSet's output - Listing 5.4: Preparing for the HIT client