[ale] perl, python, C, C++ old code readability
hirsch at zapmedia.com
hirsch at zapmedia.com
Fri Feb 15 09:23:23 EST 2002
Danny Cox writes:
> From "The Elements of Programming Style" by Kernighan and Plauger:
> Rule #1: Write clearly - don't be too clever.
An excellent rule, and one I have a constant urge to violate. That is
one of the reasons I don't like to write in perl--I think perl
encourages clever writing. If you know what you are doing, perl
allows for incredibly terse code. The are so many ways to do things
implicitly in perl that many steps are left out of the code. Reading
it then takes much longer than if the steps were made explicit.
One reason I like to write in Python is that I think it encourages
simple writing. I think many perl programmers are annoyed by having
to type the extra characters, but they make it much easier for another
human to parse. The syntactic white space of Python enforces good
indentation habits, something that is optional in every other language
I know.
I half agree with Jim Kinney that it is the programmer, not the
language, that determines the readability of the code, but only half.
If a language encourages dense and terse coding, then it is hard (not
impossible) even for good programmers to write readable code. If the
language lends itself to readable code, even not so good programmers
tend to write readable code.
--Michael
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list