This post originated from an RSS feed registered with Python Buzz
by Jarno Virtanen.
Original Post: Weinberg on test-driven development
Feed Title: Python owns us
Feed URL: http://sedoparking.com/search/registrar.php?domain=®istrar=sedopark
Feed Description: A weblog about Python from the view point of Jarno Virtanen.
Although I am not such a fan of test-driven development myself, I
found it curious that Gerald Weinberg anticipated test-driven
development (TDD) in the The Psychology
of Computer Programming originally written in the
70s. (I am sure Weinberg was not the only one anticipating TDD in the
70s.) Weinberg talks about programming tools, specifically testing
tools, and notes that [emphasis mine]:
Another well-known psychological bias in observation is the
overdependence on "early" data returns. In program testing, the
programmer who gets early "success" with his program is likely to stop
testing too soon. One way to guard against this mistake is to prepare
the tests in advance of testing and, if possible in advance of
coding.
Weinberg also warns about being too confident about the results:
[...] so advance work on test cases is never wasted--unless we yield
to the temptation to bypass the remaining tests in view of the
"excellent" results we have so far.
My personal gripe about test-driven development is the complete lack
of the so-called white box testing methods. In white box testing, you
use the source code in order to create test cases that cover the whole
functionality of the testable unit. I would go so far as to claim that
the trickiest bugs are in the edge- and corner-cases of the code
which you can reveal with white box testing. But, of course, tests in
advance of coding are better than no tests at all. (I am too often
guilty of writing no tests at all.)