Testability Drives Design

🌳 Evergreen β€’ Note β€’ Planted 27 April 2026
software-testing unit-tests software-design modularity dependency-injection

Hard-to-test code is a design smell. Writing unit tests exerts pressure that improves software in two ways. First, modularity: if a class is hard to test, it’s doing too much: too many input combinations, too many side effects, too many conflated concerns. The cure is extraction. Second, dependency injection: code that constructs its own dependencies internally is untestable without expensive integration infrastructure, so tests force you to inject from outside, making dependencies explicit and swappable.

This is testability as a design heuristic, not just a verification mechanism. The tests aren’t checking behavior. They’re revealing structural problems.

πŸ“ Related Blog Posts

🌿 Related Notes