C++/Java (was Re: [plug] Uni Course - UWA or Curtin?)

Peter Wright pete at akira.apana.org.au
Mon Nov 19 21:59:54 WST 2001


On Mon, Nov 19, 2001 at 10:47:50AM +0800, Greg Mildenhall wrote:
> On Sat, 17 Nov 2001, Jonathon Bates wrote:
> > We only use C++ in one unit and thats it. Which IMHO is sad as it is so
> > much a better programming langauge than Java <flame proof retardent at the
> > ready>.
> 
> I can't even begin to imagine what you see in C++ over Java.

Well, there are a few obvious things someone might see in C++ over Java...
(see below)

> (unless what you really mean is that you prefer C to Java)

I wouldn't understand _that_ at all. :)

> I'd love to hear your opinions. (sorry to those not interested in the
> topic, but differences and preferences between languages look like ending
> up as a career for me.  :)

You're thinking of becoming a programming language diplomat? :)

> -Greg

I'm not quite sure how familiar you are with C++ or Java (or C), Greg, but
I'm guessing at least familiar enough to write a non-trivial program in
each. Well, I had a quick glance on the 'net to see if there were any
remotely up-to-date and reasonably unbiased documents comparing C++ and
Java... and surprise surprise, there didn't seem to be (or at least not
visible to a quick glance). Most of the early hits I got from Google on
"C++ versus Java" seemed to be located on Java-promoting sites. There were
quite a few that appeared from their Google abstract to be purely
performance comparisons, which I think is a relatively small part of the
story and extremely misleading when taken in isolation. Others were simple
syntax comparisons... "this is how you do foo in C++, this is how you do
foo in Java..."

I do remember Bjarne Stroustrup (the original author of C++) writing a
rather, um, negative appraisal of Java on his site (I gather he was getting
sick of people asking him what he thought of Java so he decided to make his
opinion fairly clear :), but that's obviously going to be a horrendously
biased opinion too.

Anyway -

Well, the _most_ obvious "advantage" C++ might have over Java can be
described in three letters: STL. The C++ Standard Template Library.
Generic programming.

Having the option to use explicit memory management or a garbage collector
of your choice (as opposed to not having an option) might be considered
another advantage.

C++ being a significantly larger and more flexible language than Java
_might_ be considered an advantage - though I believe some Java proponents
might argue the opposite.

Then there are just a lot of miscellaneous things. A great deal more
choice in (for example) GUI libraries, but certainly not only that.
Greater scope in programming style and syntactic sugar. I'd be mildly
annoyed at not being able to do operator overloading, for example, if I
started programming Java seriously again - though it's certainly not a huge
thing by itself.

A language which has an ANSI standard as opposed to a standard controlled
by one vendor. Again, perhaps that depends on how much you trust Sun,
though I'd say the abortion that is Swing is reason enough not to trust
them in and of itself.

Umm.... is that enough to start with? :)

Pete.

PS. Have a look at http://www.paulgraham.com/lib/paulgraham/sec.txt if you
haven't seen it before. A good article about language comparisons in
general as well as a rabid Lisp advocacy piece. :)
-- 
http://akira.apana.org.au/~pete/

-- 
Snoopy: No problem is so big that it can't be run away from.



More information about the plug mailing list