Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] C vs. other languages (was: tlug-digest Digest V2004 #194)



Quoth Godwin Stewart (Fri 2004-07-30 04:12:59PM +0200):

> On Fri, 30 Jul 2004 09:43:32 -0400, Josh Glover <tlug@example.com> wrote:
> 
> > Sure, Java is a memory hog. Sure, it is not as efficient as good C. But
> > if you have the memory to throw at it, why not?
> 
> Because I never consider even for a second that what I'm writing is the only
> thing running on the box. That's Bill Gates' mindset, not mine. The school
> of thought I belong to basically persists in wanting to make the most of the
> resources at my disposal instead of assuming that it doesn't matter because
> there's oodles of spare CPU cycles and RAM. Oh, and disk space is cheap too
> now so we might as well compile everything static.

Programmers are expensive compared to machines. Why pay 10 months of a
programmer's salary to develop something in C that he could develop in
five months in Java or Perl or whatever, but needs to run on a $15,000
server rather than a $5000 one? Unless your programmer only makes $2000
a month (*not* a good salary, in my opinion), you have made a bad deci-
sion.

Compare yourself to Bill Gates. Who has more money? Sure, you can say
that Bill lacks any morals or scruples, but you would be a fool to say
that he lacks business sense and management skill.

Some of the best books that I have read on software development and the
management of software projects were published by the Microsoft Press,
and they all go out of their way to point out that in a tradeoff between
programmer time and machine time, programmer time almost always wins.
And voila! MS was right, hardware is now a commodity (it wasn't when MS
was founded).

In the enterprise, companies often have one huge server running just a
handful of processes. If I have a choice between using up 15% of a CPU
that is almost always idle anyway with a Java / Perl / what have you
program or using up %5 of that same CPU, why would I *ever* choose C?
(Well, the answer is sometimes I truely *need* the performance that only
C can deliver.)

> > C just takes that much more effort. I don't care how macho a C hacker you
> > are, it does.
> 
> I agree. Where we don't agree is just how much it's *worth* the extra
> effort.

It is not usually. The main points that I am making are these:

1. Programmers cost way more money than machines.
2. Most of the time, the performance of software written in higher level
   languages than C is good enough.
3. Bad performance results more often from bad algorithms (the programmer's
   fault) than a choice of language.

I do Open Source as a hobby, and my "free time" is limited, so I have the
choice of doing more software in high-level languages, or less in C. The
choice is obvious to me.

> Why are 99% of the operating system I use and its auxiliary tools written in
> C rather than Java?

Because an OS kernel is one place where performance truely matters, since
is is a potential bottleneck for *all* software running on it.

Now having said that, BeOS was written almost entirely in C++, IIRC, and
seemed to be pretty efficient.

> What about the mailer I use?

I dunno which mailer you use, but if you had to *write* a mailer today,
would you really do it in C? I sure as helll would not. I would use Perl,
and take advantage of how easy string parsing is, since that is at least
three-forths of the work of a mailer.

> A few of the tools I use (including the GUI) are written in C++ - why not
> in Java if Java's OO is so good? ("because they suck" isn't an answer...:)

A GUI is the one place where not using OO is just plain stupid. Even GUI
libraries written in C emulate OO. The reason that more Open Source tools
are not written in Java is (at least) twofold:

1. Java is a relatively new language. Open Source types have been using
   C for ages (and some of them use C++, but most Open Source types hate
   C++ almost as much as Java), so why should they switch now?
2. Java has been so overhyped by the industry rags (cures cancer and male
   pattern baldness!) that many Open Source, anti-establishment, anti-
   commercial types loathe it in a sort of knee-jerk reaction.

The bottom line is, if you are coding for fun, choose whatever language
gives you the most pleasure. I must admit that coding in C makes me feel
really smart. Sometimes I like that sort of thing. But Perl, OTOH, makes
me feel really productive, and allows me to concentrate on the logic of
my program, not the boring memory management shite that will hold my
exquisite house of cards together! :)

In my day job, I am faced with deadlines that often make coding in C a
complete impossibity. Like I said, even for the systems programming that
I do, Perl or even Java is often a better choice than C.

Shit, ESR himself agrees with me on this point, as do the Pragmatic
Programmers, K & P, Joel (of Joel on Software), the Peopleware chaps,
the list goes on of people who have said: For Thy First Stab at Writing
Code to Solve a Problem, Thou Shalt Useth a High Level Language; Oftimes
Thou Shalt not Even Need to "Throw out Thy Prototype" and Write Thy
"Real Programme".

Anyway, I did not mean for this to degenerate into a holy war. :)

G'night,
Josh

-- 
Josh Glover

Gentoo Developer (http://dev.gentoo.org/~jmglov/)
Tokyo Linux Users Group Listmaster (http://www.tlug.jp/)

GPG keyID 0xDE8A3103 (C3E4 FA9E 1E07 BBDB 6D8B  07AB 2BF1 67A1 DE8A 3103)
gpg --keyserver pgp.mit.edu --recv-keys DE8A3103

Attachment: pgp00070.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links