Question:
Which is better, Java or C++ in terms of...?
hakhaimo
2007-12-29 06:25:17 UTC
As an MIS student, i already know how to use both C++ and Java. I just want to know which is better C++ or Java in terms of:

1.) Application (Games, Business Applications and Others).
2.) Database Usage on MySQL or other Database Systems.
3.) Complexity (Which is more complex than the other).
4.) Other strengths and weaknesses over the other.

Thank you very much!
Five answers:
2007-12-29 07:36:57 UTC
If you ask around your local CS faculty, you'll find that most computer scientists think that C++ deserves to burn in the deepest darkest corner of hell. But their opinion of java isn't a lot better.



C++ is a horribly complex language. Almost no one knows the entire thing, and different features of the language are known to break each other. Seeing as you say you know C++ I'm sure that you have already bumped into some of its problems.



That said, a good well designed program will work out well on either platform. C++ lets you write faster more efficient code, but unless you know you need to do that, all you'll end up doing is building a horrible unmaintainable mess.



Java implements a much purer form of OOP than c++ which means that your designs have a little less room for error (although again, I've gotten into some pretty nasty snafus with java)



So point by point:

1a) Games

You definitely want c++ here. Game programming is one of the rare exceptions where you need all the performance you can get. Unless your game has very little in terms of graphics, you will want c++.



1b) Productivity

Java. You don't need c++. Garbage collection in java means that you won't have memory leaks bringing down your business systems. While both languages have been proven in the real world, i see no reason to start a new application in c++. Back in the dark ages, the Java VM was a little crappy and you got sluggy performance, but this has been for the most part all fixed.



2) Databases

Either one is fine, there are hundreds of libraries for any database imaginable here, and there aren't massive differences. However some of the big heavy commercial databases (oracle for example) use java internally, so you can write java that runs directly in the database engine which might give it a small lead.



3)

Java wins hands down. C++ will leave you wanting to stab people in the face. While Java generics can be a little mind bending they are nowhere near the sheer trauma that C++ will do to you.



4)

Garbage Collection. There's no reason why you should be doing it yourself in a modern language. There are lots of C++ libraries that will do it for you, but that should ring warning bells about why you are using c++ in the first place.



A real OOP language has no use for pointers. C++ will make you use them.



A good OOP language shouldn't need to bloat the size of your program every time you use generics



I'm sure I came off a little biased, but in my opinion 99 times out of 100, if you are using c++, you should be using java. Not that java is without its problems, but thats a different question.
MGohara
2007-12-29 07:48:03 UTC
1) For games most are written in C++ because of speed that and knowing pointer arthimetic. More business applications are written in Jave NOW then C++ but more are being written in C#. If you are doing low level stuff like hardware access and device drivers it is C an C++.



2) Most databases the drivers are written in C++ but for accessing the data both are equal in performance.



3) C++ is more complex because of some of the arcane ways to do the same thing (these are done for speed). The Java language is a stripped down version of the C and C++ language the have removed direct access to pointers and you cannot easily access some of the direct access stuff of the OS.



4) Both C++ and Java are cross-platform. It is easier to write cross-platform in Java because it keeps the OS dependent functions insulated from the program (that is in the JVM). C++ is also native compiled and not JIT so there is faster execution. This give C++ an advantage in that it doesnt need extra memory for the the JVM and in memory compilation.



Overall both are good languages it depends on what you are doing or planning to do.
sumitavo b
2007-12-29 06:38:54 UTC
Java always leads the way ahead from C++ in the points that you have mentioned.
Tarun S
2007-12-29 07:05:05 UTC
man JAVA is btter in all the applications that u hav mentioned ,also JAVA is very helpful in creation of GUI as compared to c++, and the best thing 'bout JAVA is that JAVA has NO POINTERS ,thus no tension of viruses and also JAVA is platform independent!!!!!!!!!!!!!!
?
2007-12-29 07:10:17 UTC
java, jsp

http://www.oylinki.com/phpBB/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...