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

Skip Montanaro skip at pobox.com
Thu May 1 20:31:13 EDT 2003


    John> Seriously, he's got quite a few good points, but they are all from
    John> the "test afterwards" school of thought. As far as I can tell, the
    John> best approach is not to put the bugs in there in the first place.

    John> This is the approach advocated by such luminaries of the early
    John> Software Engineering school as Djikstra, Hoare and Wirth with
    John> their notions of producing a program proof before writing code.
    ...
    John> Done with appropriate diligence, both approaches result in
    John> essentially bug-free code on the first commit to the repository.

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, 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.

Skip





More information about the Python-list mailing list