Are most programmers male?
peter at engcorp.com
Tue Aug 13 13:44:20 CEST 2002
Dilton McGowan II wrote:
> > Yup. The code itself is worth _something_, but the real asset is the
> > knowledge that was used/acquired when creating the code, and that
> > knowledge is terribly hard to extract from the hermit. This is the same
> > reason why code is easier to write than it is to read, and why programmers
> > (myself included) are always tempted to throw old code away and write a
> > better version instead of endlessly tweaking the old stuff.
> I agree that it should not be as tempting to re-write old code. Does that
> mean that our languages are not expressive enough? Perhaps that's why I've
> recently started looking again, after Java. One thing's for sure, I keep
> going back to C++. I do like what I've seen of Python and am encouraged. I
> think there's no good language, only a good mixture.
I've found that when code is developed test-first, it is rarely tempting
to rewrite old code. In fact, I consider code developed test-first to be
a _real_ asset, rather than just some lines of text someone wrote that is
cluttering up random folders on his hard drive after he left. Other
code does not seem to have so much intrinsic worth.
With a single command you can verify that all this old code passes its
tests (if it doesn't it was not complete, so you can safely trash it if
you wish, although it's still pretty easy to see if you can fix the one
or two problems it might have).
You can examine the tests to figure out what the programmer thought it
was supposed to be doing, rather than what the documentation he might have
read suggested maybe it should do.
Code without tests is definitely much less likely even to be looked at,
and if it is it will be with a very critical eye, and more often than not
the verdict will be "toss it, we can do better".
More information about the Python-list