Python vs Ruby

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sat Oct 22 19:44:25 EDT 2005


On Fri, 21 Oct 2005 13:03:29 +0100, Alex Stapleton wrote:

> 
> On 21 Oct 2005, at 09:31, Harald Armin Massa wrote:
> 
>> Casey,
>>
>>
>>
>>> I have heard, but have not been able to verify that if a program is
>>> about
>>> 10,000 lines in C++
>>> it is about
>>> 5,000 lines in Java
>>> and it is about
>>> 3,000 lines in Python (Ruby to?)

I suspect it is considerably less than that, although it depends on the
specific code being written.


>> BTW: it is normally only 50 lines in Perl. Not that you could read it,
>> though
>>
>> Harald
>>
>>
> Perl is more like a CISC CPU. There are a million different commands.
> Python is more RISC like.
> Line count comparisons = pointless.


Not so.

Every line = more labour for the developer = more cost and time.
Every line = more places for bugs to exist = more cost and time.

I find it sometimes helps to imagine extreme cases. Suppose somebody comes
to you and says "Hi, I want you to develop a web scrapping application to
run on my custom hardware." You look at the project specifications and
realise that the hardware has no OS, no TCP/IP, no file manager, no
compiler. So you have to quote the potential customer on writing all these
layers of software, potentially tens of millions of lines of code.
Even porting an existing OS to the new hardware is not an insignificant
job. Think how much time and money it would take.

On the other extreme, the client comes to you and asks the same thing,
except the hardware is a stock-standard Linux-based PC. Your development
environment already contains an operating system, a file manager,
TCP/IP, compilers, frameworks... and wget. The work you need to do is
potentially as little as writing down the command "man wget" on a slip of
paper and pushing it across the table to your customer.

As programming languages go, C is closer to the first extreme, C++ a
little further away, Java further away still, because Java provides
more capabilities already built-in that the C programmer has to
create from scratch. For many tasks, Python provides even more
capabilities, in a language that demands less syntax scaffolding to make
things happen. Every line of code you don't have to write not only is a
bug that just can't happen, but it also saves time and labour.


-- 
Steven.




More information about the Python-list mailing list