Tests are the real contract

We’re all familiar with Paralysis by Analysis, a state in which the wide choice of options blocks us from making decisions. A range of choices usually driven by “What If …” - hypothetical issues that might happen rather than immediate issues that will happen. And in software, it often derives from a belief that the interface is a contract.

If the interface is a contract, then it is a terribly underspecified one. Clarity about the primary purpose of a module is muddled by confusion about edge cases. Rather than implement code satisfying our current need, we try to implement behavior in unspecified situations in an attempt to satisfy the contract.

Tests are the real contract, defining the correct behavior in supported use. That which is not tested is not supported. As opposed to the interface, with its minimal distinction between supported and unsupported use. Start coding to the tests and stop coding to “What If …”.

Back to What I could have learned from XP.