Hacker News new | ask | show | jobs
by alecbenzer 2166 days ago
I meant expand on how those things make code easier to understand, not why unit testing causes you to adopt them.
1 comments

Mainly it reduces surprise. If you call an interface with implicit dependencies, you won’t know if why it’s breaking without debugging and making sure it sets up its dependencies properly. If you call a testable interface with explicit dependencies, you can mock out those dependencies to debug parts individually.