Efficient python programming...
Peter Hansen
peter at engcorp.com
Sun Jun 9 02:59:11 EDT 2002
Kragen Sitaker wrote:
>
> Peter Hansen <peter at engcorp.com> writes:
> > Roman Suzi wrote:
> > > To prove that code is correct is very difficult (practically impossible).
> > > Unittests are there to prove that you have errors, not the other way
> > > around.
> >
> > I disagree, if the tests are written first (and run, proving that
> > they will fail when the code is wrong or missing).
>
> I think you are disagreeing because you are ignorant of formal methods.
No, you're wrong. I'm familiar with formal methods. I was actually
disagreeing because I've been writing these way too late at night
without adequate sleep and my logic centres are deprived and my
language centres are sluggish.
Suffice to say that in another thread I backed away from "tests
can prove anything" -- I was wrong.
What tests do, however, is vastly increase your confidence in the
correctness of the code, and when written properly (in advance
of each small morsel of code that is written, and having been
shown to fail without that code) they are sufficient to deliver
extremely high quality software in which you can have high
confidence. And, I believe, _necessary_ for the same.
-Peter
More information about the Python-list
mailing list