Code correctness, and testing strategies

Roy Smith roy at panix.com
Sat May 24 18:04:31 EDT 2008


David <wizzardx at gmail.com> wrote:
> Problem 1: You can only code against tests

Yup.  That's the flavor of Kool-Aide being served at a convenient TDD 
outlet near you.

> Basically, with TDD you write the tests first, then the code which
> passes/fails the tests as appropriate. However, as you're writing the
> code you will also think of a lot of corner cases you should also
> handle. The natural way to do this is to add them to the code first.

That's only the natural way if you're haven't drunk the Kool-Aide :-)  It 
takes a while to get used to, but once you get the hang of it, doing it 
this way becomes very natural.  Sure, I think of corner cases when I'm 
writing code.  But, what I do with them is write a test for them first, 
then write the code which implements it.



More information about the Python-list mailing list