97 Things Every Programmer Should Know

(Chris Devlin) #1

Collective Wisdom from the Experts 167

Testing “hard” things is tough because you have to build them to test them,
which discourages speculative building just to see what will happen. But the
building process in software is ridiculously cheap. We’ve developed an entire
ecosystem of tools that make it easy to do just that: unit testing, mock objects,
test harnesses, and lots of other stuff. Other engineers would love to be able
to build something and test it under realistic conditions. As software devel-
opers, we should embrace testing as the primary (but not the only) verifica-
tion mechanism for software. Rather than waiting for some sort of calculus for
software, we already have the tools at our disposal to ensure good engineering
practices. Viewed in this light, we now have ammunition against managers
who tell us “we don’t have time to test.” A bridge builder would never hear
from his boss, “Don’t bother doing structural analysis on that building—we
have a tight deadline.” The recognition that testing is indeed the path to repro-
ducibility and quality in software allows us as developers to push back on
arguments against it as professionally irresponsible.

Testing takes time, just like structural analysis takes time. Both activities ensure
the quality of the end product. It’s time for software developers to take up the
mantle of responsibility for what they produce. Testing alone isn’t sufficient,
but it is necessary. Testing is the engineering rigor of software development.

Free download pdf