peter at engcorp.com
Tue Aug 13 02:22:46 CEST 2002
Andrew Koenig wrote:
> Peter> Maybe I'm spoiled by XP and having so many unit tests that
> Peter> I am willing to refactor aggressively like this without any
> Peter> qualms...
> Maybe you haven't been bitten badly enough yet.
That could well be true.
> As I understand it, one of the tenets of XP is that once the tests
> pass, you're done.
That notion is far too simplistic and naive to be considered a _tenet_
of XP. It may be one of the pat phrases used in trying to communicate
some of the principles involved to newcomers, but few people think
the world is so black and white as that. Generally speaking,
one the code passes the tests a programmer moves on to other tasks,
but it's not entirely up to the the programmers whether this is
sufficient in any specific case. XP is much more practical than it
> The trouble with that notion is that I have seen too many cases
> in which programs have bugs that no amount of testing
> can ever reveal with certainty.
It's well understood in the community that there are areas, such
as security and concurrency, where the standard ways of doing
unit testing XP-style are insufficient.
> [...] In fact, the hardest such bug that I can remember
> encountering in my own code was in a program written in a semantically
> safe language.
> After that experience, I am reluctant in general to make large-scale
> transformations in programs without advance evidence that doing so
> will not introduce subtle errors. I understand that such
> transformations (in the guise of ``refactoring'') are popular these
> days, but I've been in this field long enough to see many popular ideas
> come and go, and will reserve my judgment on this one until it has
> had ample time to prove itself.
Professional programmers generally have enough experience and ability
to understand that extensive unit tests are insufficient in and of
themselves to allow such refactoring to be done safely in all cases.
I didn't get the impression that the program in question in this
discussion was one such case... Anyway, you're welcome to ignore
all my comments, or consider some of them in this specific case,
as you will.
More information about the Python-list