Skip to content

Testing as Design Feedback

Difficulty in testing reveals design flaws - hard-to-test code typically has excessive coupling, hidden dependencies, or unclear responsibilities; the pain of testing is diagnostic information about the production code's quality.

Tension Addressed

Sensitivity vs. Stability

Recognizable As

Complex test setup indicating too many dependencies; need for extensive mocking indicating tight coupling; inability to test in isolation indicating missing seams; tests requiring global state manipulation

Canonical Sources

Feathers, "Working Effectively with Legacy Code" (2004); Freeman & Pryce, "Growing Object-Oriented Software, Guided by Tests" (2009)

Transfers To

Usability testing revealing design flaws; code review feedback; documentation difficulty indicating API complexity

When tests require extensive setup, mock dozens of dependencies, or manipulate global state, this isn't a testing problem - it's a design problem. Testable code tends to be well-designed code because both require clear interfaces, explicit dependencies, and appropriate scope.