Correct code/unit testing (was Re: Efficient python programming...)
John J. Lee
jjl at pobox.com
Sun Jun 9 23:25:40 CEST 2002
On Sun, 9 Jun 2002, Peter Hansen wrote:
> Kragen Sitaker wrote:
> > shown) that careful reasoning and code reviewing is necessary and
> > sufficient to write correct code.
> ego, you'll be devastated by the repeated proof that you will never,
> ever get it right the first time, or even after lots of reviewing.
Not quite never. It *does* happen, but with the same sort of frequency as
I find dropping from a five club juggle leads to one landing upright on
the floor and staying there: it *has* happened to me, exactly three times
in about a decade of practice.
(what's a club?: http://www.windwizards.com/henrysjuggling.html)
> > It is certainly possible to err too far in the direction of believing
> > your code correct simply because it passes its test suite, and this is
> > a common beginner's error. I think it is also possible to err too far
> > in the direction of writing and running tests instead of desk-checking
> > code.
Isn't it true that, however much time you're going to spend, the largest
number of bugs are going to get removed by allocating some of the time to
both activities: testing, and staring at the code?
More information about the Python-list