FDEInterviews logo
💻 Coding & Engineering Craft
Core

Testability and Dependency Injection

Code that reaches out to the clock, the network, the filesystem, or a random generator cannot be tested deterministically, because its output depends on the world. The fix is to separate pure logic from side effects and inject the things that touch the world (the clock, I/O, randomness) so a test can pass fakes. When you inherit untestable code, pin its current behavior with a characterization test first, then refactor under that net.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
LESSONS THAT TEACH THIS
PRACTICE THIS IN REAL QUESTIONS