|
A good programmer will choose the right tool for the job. Sometimes that's something like C, or C++, or something on the opposite end like Ruby or Python. Of course, there are a million other languages.
I don't think you can say which language is better -- all you can do is weigh the benefits of each.
* Java has built in garbage collection, which is a major factor for a lot of people. (By the way, it's quite possible to write memory-leak proof C++ with smart pointers like std::auto_ptr, boost::shared_ptr (tr1::shared_ptr), and tr1::unique_ptr).
* Java has built-in threading support (C++0x will as well).
* Java has several tightly-coupled GUI frameworks, whereas C++ has several independent, unofficial GUI frameworks.
* Java is probably more portable than C++.
* Java runs through a virtual machine, which tends to slow things down. However, this can also allow Just-In-Time compiling, which can speed things up!
* The garbage collection in Java can also be a performance issue. C++'s std::auto_ptr and tr1::unique_ptr have no performance slowdowns over correctly-written hand-written code.
* C++ is huge (and C++0x will only make it bigger) and has a massive learning curve. It can take years to become a C++ expert.
* C++ has pointers! Pointer should be avoided if possible, but sometimes you need a pointer!
I write professional CAD software for a living. It's in C++ (but to be fair, it was originally written before Java was available). However, if we wrote it in Java, its performance would probably suffer (especially the ray tracer portion that I'm in charge of).
However, if you're looking to learn programming, I'd start with C++. It's harder to learn than Java, but you'll be forced to learn the fundamentals. Many Java programmers are unaware that it's possible to write a memory leak within Java!
|