Data-driven testing

Peter Hansen peter at engcorp.com
Fri Apr 25 09:05:51 EDT 2003


Anton Vredegoor wrote:
> 
> The problem that comes up is that often, while playing, pieces of code
> are produced that could become important later. After all this is the
> source of almost all coding creativity isn't it?
> 
> So now we have a respectable programmer with all kinds of crazy code
> snippets, some of which could become of considerable value to himself,
> to the employer, and to other coders. However, there's no way to share
> them without losing credibility among the other "professional" coders.

You make an excellent point.  I believe that in some throwaway scripts,
perhaps most, there is somewhere a nugget or two of real value.  It
is *those* pieces for which I would write tests, even in a throwaway
script, perhaps because I instinctively believe the chance of that
*portion* of the script needing to be re-used is somewhat higher.

I wrote elsewhere that code without tests is a liability, while code
with good tests is an asset.  I think that goes directly to the heart
of this matter: the throwaway script *can* be made at least partially
useful to others, later, if it has good tests for the important parts.  
If it does not, you are quite right that you can't share it without
losing some credibility, with co-workers or other programmers.

Thanks for finding a reason to continue the discussion, and perhaps
a point where Alex and I will find our agreement. :-)

-Peter




More information about the Python-list mailing list