Python vs Ruby
Alex Martelli
aleaxit at yahoo.com
Sat Oct 22 21:56:25 EDT 2005
Mike Meyer <mwm at mired.org> wrote:
> > Every line = more labour for the developer = more cost and time.
> > Every line = more places for bugs to exist = more cost and time.
>
> There were studies done in the 70s that showed that programmers
> produced the same number of debugged lines of code a day no matter
> what language they used. So a language that lets you build the same
> program with fewer lines of code will let you build the program in
> less time.
Of course, these results only apply where the "complexity" (e.g., number
of operators, for example) in a single line of code is constant. There
is no complexity advantage to wrapping up code to take fewer LINES, as
such -- e.g., in Python:
for item in sequence: blaap(item)
or
for item in sequence:
blaap(item)
are EXACTLY as easy (or hard) to write, maintain, and document -- it's
totally irrelevant that the number of lines of code has "doubled" in the
second (more standard) layout of the code!-)
This effect is even more pronounced in languages which allow or
encourage more extreme variation in "packing" of code over lines; e.g.,
C, where
for(x=0; x<23; x++) { a=seq[x]; zap(a); blup(a); flep(a); }
and
for(x=0;
x<23;
x++)
{
a=seq[x];
zap(a);
blup(a);
flep(a);
}
are both commonly used styles -- the order of magnitude difference in
lines of code is totally "illusory".
Alex
More information about the Python-list
mailing list