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)



On Fri, 30 Jul 2004 22:12:26 -0400, Josh Glover <tlug@example.com> wrote:

> Programmers are expensive compared to machines.

Depends where you are.

> 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,

Because a C programmer costs less than a C++ or Java programmer right from
the outset.

> 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 decision.

Hey, this is France, a 3rd world country as far as IT is concerned. I'm
self-employed but nearer the $9000 mark.

Per year.

No, that's not a typo.

> 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.

That's the only thing of any value at M$. They can't program worth shit but
they *do* know how to sell their garbage. "This isn't a bug, it's a feature"
comes to mind, as do the illegal contracts with OEMs forbidding them from
selling machines without Windwoes installed on them.

> 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.

Heh - no kidding! Coming from Microsoft that's hardly a surprise.

> 1. Programmers cost way more money than machines.

People in this country are cheap. They don't have the notion of quality IT
work merely because they're still afraid of the demi-god "computer" and
really don't know what it's all about. Therefore, they go with the cheapest
contractor - when $boss doesn't get $whiz_kid_offspring to cobble something
together in VB (bootleg copy, bien entendu), which happens all too
frequently (sometimes with disastrous conesquences). In this instance, the
hardware is the main cost, not the software.

Pretty much elsewhere, people buy off-the-shelf software.

Back in 1990, all the records of the company I was working for (repairing
electronics) were paper. There was an XT up in the office but it was only
used for printing out banners or stupid things like that. There was *no*
computer for managing clients or their equipment we had in for repairs. Not
only was there no computer, but there was no question of buying one because
it was considered an unnecessary expense.

We happened to be a Zenith Data Systems repairs centre, so there were a few
old ZDS carcasses hanging around the place. I managed to put together an
XT with all of 640KB of RAM, a 360KB floppy drive, a 20MB HD (5.25" and it
took about 30s to spin up) and a CGA graphics card.

My boss had a copy of Multiplan 3. I don't know how he got hold of it, nor
do I want to know, but I'm pretty sure I know how much he paid for it. I
used that POS old XT and Multiplan 3's macros to build a system which
handled all the equipment in the workshop, and did so for the next 12 years.

There was no question of doing the programming during work hours. After all,
the business had been running on paper for years already so there was no
point in automating anything, was there! So I did it in my spare time,
mostly because I was fed up to the back teeth having to search through
handwritten notes each time a client called wanting to know what was
happening to that autopilot or VHF transciever.

The same spreadsheet was still being used up until 2002, but they had
upgraded the computer to a 486 by then...

All of this is to say that people are CHEAP here. If they can get something
for nothing or next to nothing, that'll do, so it boils down to what the
cheapest person has to offer. C++/Java programmers don't come cheap and many
end up working overseas where clients are willing to pay them more than a
pittance.

> 2. Most of the time, the performance of software written in higher level
>    languages than C is good enough.

Plus, as you already pointed out, local processing isn't usually the
bottleneck. I/O is. But it does also depend how often you're going to be
using the script/program. 0.1s per mail saved on something analysing inbound
mail, for 100,000 inbound mails each day, means nearly 3h processing saved
per day.

However, if I build a web page that displays OK in Mozilla and IE, it may be
"good enough", but it isn't good enough for *me*. I also make it pass the
test at http://validator.w3.org even if there's no visual change because I
can now rest assured that any other browser I hadn't thought of that screws
up the page is b0rken, not my page.

> 3. Bad performance results more often from bad algorithms (the
>    programmer's fault) than a choice of language.

True.

> I dunno which mailer you use,

Sylpheed. Written in C.

> but if you had to *write* a mailer today, would you really do it in C?

Yes. Without hesitation. Possibly C++ because it *would* make sense for this
application. But definitely not in Perl or Java.

> 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.

libpcre maybe? Perl-compatible regular expressions in C code. Great stuff,
you should try it.

> > 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?

If it's as time-saving, clean and powerful as you're making out, surely
that's a good reason in and of itself!

> 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.

That is entirely possible - although I hadn't looked at it that way.

However, I think the main reason it hasn't taken off in OSS circles is
because it means learning a new set of skills in order to produce something
that isn't as efficient as that which current skills can produce. Whether
the emphasis is more on the "learning a new set of skills" bit (laziness,
fear of the unknown) or on the "not as efficient" bit, I don't know.

Furthermore, the main "thing" with OSS is the fact that you're distributing
source code 99% of the time. Therefore, whether a compiled Java applet can
run on any platform with a suitable JRE or not is irrelevant because you're
not distributing the bytecode anyway. Why distrbute something which requires
both a Java compiler *and* a JRE when you can distribute something which
requires just a bog standard C compiler with a few (standard) libraries?

> The bottom line is, if you are coding for fun, choose whatever language
> gives you the most pleasure.

Agreed.

> 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! :)

I see your point.

What I'll often do is use a higher-level language to work on the logic of a
program, and then translate the intermediary product into something more
efficient - IF THERE IS SOMETHING TO BE GAINED. I'm not going to translate a
10-line bash script run once a day into C for shits & giggles.

For example, remember the Sinclair Spectrum (ca. 1984)? A neat little
machine with a Z80 CPU, 16K or 48K of RAM depending on the model, and a
colour output fed into the TV via an RF modulator. It came with a dialect of
BASIC in ROM.

One of the first projects of mine on that was to write an assembler for it.
I wrote it in BASIC. I then translated the engine from BASIC to Z80 assembly
language, and used the BASIC assembler to assemble it. From then onwards, I
used the faster engine to assemble the translations of other parts as and
when they were done, and wound up with something pretty fast and powerful,
that had a built-in text editor and tape I/O, and that worked in a few KB of
RAM instead of the BASIC program which used up half the available RAM.

It took me a week to write the thing in BASIC and another 2 to translate it,
but it was worth it because of the substantial gain in speed and the much
smaller footprint.

> 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.

Deadlines usually put spanners in the works :)

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

This could easily have degenerated into a flamefest anywhere else. One of
the good things about TLUG is that people can disagree but still remain
civil.

-- 
G. Stewart   --   gstewart@example.com -- gstewart@example.com
Registered Linux user #284683 (Slackware 9.0, Linux 2.6.7-em8300)
--------------------------------------------------------------
"Here, Outlook Express, run this program!"  "Okay, stranger."

Attachment: pgp00072.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links