Where did you learn to unit test? How did you learn?

Steven Taschuk staschuk at telusplanet.net
Thu May 1 21:11:15 EDT 2003


Quoth Skip Montanaro:
  [...]
> The main problem with the program proof approach is that a) writing a
> correct proof is exceptionally hard for all but the simplest program
> fragments, [...]

Dijkstra, incidentally, advocated a correctness-by-construction
approach which has some interesting analogies to test-driven
development.  For example, he even advocated writing the proof
first, then writing the program to satisfy the assumptions of the
proof.  (Obviously this would be done incrementally in practice.)

Thus, just as doing TDD makes you write programs which are easy to
test, following Dijkstra makes you write programs which are easy
to prove correct.

> [...] and b) most of us in the computing profession (myself included)
> couldn't prove our way out of a paper bag anyway.  On the other hand, I can
> write simple unit tests with a fair degree of confidence (most of the time).
> Taken together, they support the notion that test-driven development is the
> more practical way to reduce software bugs.

No objection from me.  Proofs are harder than tests, and the
effort is way beyond the point of diminishing returns for most
parts of most programs.

-- 
Steven Taschuk             "The world will end if you get this wrong."
staschuk at telusplanet.net     -- "Typesetting Mathematics -- User's Guide",
                                 Brian Kernighan and Lorrinda Cherry





More information about the Python-list mailing list