Although I am not yet an educated programmer in neither Java nor C++ I do have some experience in the differences between them.
The first thing, of course, is that dealing whit graphics is a lot easier in Java than C++, but instead of stating the obvious I want to throw in some of my own opinions and experiences whit Java's JFrame, which is the package I use the most. Even though it is really easy to make your own menus and windows whit JFrame compared to C++, I still haven't found one single website that lists all the different layouts a panel can be made whit. All those I know, I have learn from friends at school. But that's just one example, there are many more. Now, I'm not saying that it is impossible to learn JFrame, my point is that there are way to many built-in functions you can use. And that's my biggest found difference between Java and C++. In C++ you have to make the functions you need on your own or "include" functions other people have made, while in Java the most time is put into learning all built-in features. I haven't yet decided which of the two I prefer, but I will keep learning both and hopefully then I can help those of you who wonder which to learn or where to start.
And to those of you who already know both Java and C++ like the back of your hand, please comment and tell me what you think of the two. Which is better? Faster? Easier?
Cheers!
Strictly speaking the gui components of java are not part of the language definition (and if you happen to develop for say android you will not find any swing or awt classes). so to compare that you would have to throw in a gui toolkit like qt on the c++ side.
ReplyDeleteAll these toolkits (and Java's framework in particular) have the fundamental problem, that they can only grow and never shrink. Java 1.0 was very slim (and incomplete).
One has to develop certain techniques to find the needed information
(like for panel layouts looking in the javadocs which classes implement the LayoutManager / LayoutManager2 interfaces)
That said, the inclusion of the whole java framework in most installations is in many cases a big plus, because one has not to bother with delivery of gui libraries of all the operating systems one wants to support.
Speed comparison is very difficult (the german computer mag c't made an attempt a while ago, though). In principle you can write fast code in both languages (and slow code as well :) ). there are situations where c++ with a good optimizing compiler has the edge, but then, there are also situations where the just in time compiler of Java has an advantage, because it can use runtime information and optimize critical parts of the program separately.
As a language java is probably simpler and maybe less error prone.
T.