Efficient python programming...
Roman Suzi
rnd at onego.ru
Sat Jun 8 01:57:54 EDT 2002
On Fri, 7 Jun 2002, Peter Hansen wrote:
>Roman Suzi wrote:
>>
>> On Fri, 7 Jun 2002, Peter Hansen wrote:
>> > You forgot the even more important first thing for a beginner:
>> > get it correct! The only good way to do this is to write unit
>> > tests that prove it. If you don't have tests, you don't have
>> > working code (or how can you prove it?).
>>
>> 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.
>>
>> Of course, they can increase your confidence in that optimized code is
>> equivalent to what you had before.
>
>I disagree, if the tests are written first (and run, proving that
>they will fail when the code is wrong or missing).
>
>The tests are executable requirement specifications. Running
>them "proves" (yes, not 100%... nothing could) that the code
>meets the specs. The specs could be wrong of course, but that
>doesn't mean the code is broken...
I can agree that tests give practical confidence in the
tested code, but I was speaking about rigourous
verification that code is 'correct'.
And tests can test only some subset of input-output
mapping. Making tests is an art, is not formal act.
I had no intention to say tests are useless, only that
they are not a method of proving the correctness of code
or correctenss of code modifications.
Sincerely yours, Roman Suzi
--
\_ Russia \_ Karelia \_ Petrozavodsk \_ rnd at onego.ru \_
\_ Saturday, June 08, 2002 \_ Powered by Linux RedHat 7.2 \_
\_ "Things are getting worse. Please send chocolate." \_
More information about the Python-list
mailing list