Quote:
Originally Posted by Al3+
My first impression of Java (and this will remain my impression until I have to learn it for some reason) was that Java code contains lots of fluff. What is the real difference and what makes it better for newbies? Is it just the fact that it's easier to make memory problems in C++?
|
Java hides the idea of pointers. When I'm working with new programmers, the hardest things for them to learn how to work with are pointers. And not having to worry about pointers gets rid of the entire class of problems that you can get into with pointers. Java also does inheritance with objects nicer than C++. I have come away with a more "friendly" feel of Java after having worked with it as compared to C++.
Also, when there is an error in some Java code, it throws an exception with a nice stack trace, and then dies. This includes trying to dereference a null handle. C/C++ will typically just continue on after having written junk to a random spot in memory, or segfault, or even worse, segfault in an entirely different spot in your code. If you are good with your tools, this isn't that big an issue, but if you are just starting, segfaulting at a different random spot in your code is a royal pain to debug.
I'm not sure I agree with your fluff statement. I interpret you to be talking about code density, and I've found that Java has pretty much the same density as C++, if not slightly better code density.
FYI, Java gets compiled into a bytecode with a JIT compiler, which is pretty efficient. It runs fairly close to native speed.