Where did you learn to unit test? How did you learn?

John Roth johnroth at ameritech.net
Thu May 1 22:08:59 EDT 2003


"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1051835583.6001.python-list at python.org...
>
>     John> Seriously, he's got quite a few good points, but they are
all from
>     John> the "test afterwards" school of thought. As far as I can
tell, the
>     John> best approach is not to put the bugs in there in the first
place.
>
>     John> This is the approach advocated by such luminaries of the
early
>     John> Software Engineering school as Djikstra, Hoare and Wirth
with
>     John> their notions of producing a program proof before writing
code.
>     ...
>     John> Done with appropriate diligence, both approaches result in
>     John> essentially bug-free code on the first commit to the
repository.
>
> The main problem with the program proof approach is that a) writing a
> correct proof is exceptionally hard for all but the simplest program
> fragments, and b) most of us in the computing profession (myself
included)
> couldn't prove our way out of a paper bag anyway.  On the other hand,
I can
> write simple unit tests with a fair degree of confidence (most of the
time).
> Taken together, they support the notion that test-driven development
is the
> more practical way to reduce software bugs.

Well, I agree that, at this time, TDD is the most practical. I don't
agree that it will always be so, and thanks for the opportunity to climb
up on the soapbox where I can reach my hobby-horse.  :)

I've always seen two problems with the program proof school. One
is that, for the general run of programs, proving the assertions is
mind-numbingly repetitive and boring.

The second is that there's no tool support. By that I mean something
that would allow me to develop the assertions and program in parallel
the
same way I develop tests and program today, and at the same pace.
If that was there, I suspect that we'd replace tests with assertions
rather
rapidly. They are far more powerful - you can express global qualities
easily that are practically impossible to express with tests.

The lack of tool support means they also currently have the same
problem as inspections. They aren't persistant like automated tests.

John Roth

>
> Skip
>






More information about the Python-list mailing list