PDA

View Full Version : Java and C++ facts


Cj Shadows
07-11-2006, 07:06 PM
Okay alot of people don't know what to choose or what the differnce is between Java and C++. I'm gonna try and list all the Pros and Cons I can so people know what they really want to choose when it comes to programming.

Java
Pros: -It is basicly a simpiler C++.
-It use portable applets, so any program you make does not have to be download, you just upload the applet on the web page.
-More basic, more easy to use. May help you with C++
-Leaks all garbage and bad code.

Cons: - uses a virtual machine to run apps so apps are slower then regular compilers.
-Since it does not use machine code, programs will lag
-Does not support amazing graphics
-Since it runs on a web page there may be critical errors on the web page, internet, computer causing a chrash.
-Uses C++s more advanced features in simpler code but not as powerful nor does it have everything C++ has.

C++
Pros: -Handles much larger programs and projects
- Supports imported GFX,Direct X, Sounds with DLLs'
-Uses CVS to organize everything, usefull for big game projects
-Uses native machine code(compiles into binary code)
-Much more freedom and features.
-All libaryes in C++ remove the hassel of detail

Cons: -Advanced code that takes time to learn
-Complex syntax lends itself to abuse
-Does not support APPs so must down load but much more organized and will not lag.
-Takes time, for each differnt level you make in C++ must me a source code, and many other files.

ractoc
07-11-2006, 07:47 PM
First of all, let me guess, you're a C++ programmer....
Because while all of the C++ statements you make may be acurate but your Java stements are outdated. You have probably been reading documents about it from way back when. Let me try and correct you where needed.

Java
Pros: -It is basicly a simpiler C++.

Yes and no. Since I know both C++ and Java I can state that Java may be easier to start with. But since it is far more Object Oriented then C++, getting the most out of the code means you need to have a very good understanding of OO as well, which makes it a bit more difficult


-It use portable applets, so any program you make does not have to be download, you just upload the applet on the web page.

This statement is hopelesly outdated. While it would have been true about 4-5 years ago, nowadays Java is used primarily in server environments. Ther applets make up about 5% of all the Java applications out there.


-More basic, more easy to use. May help you with C++

See my statement above. Java may be easy(/easier) to start up but it is difficult to master because of the OO involved to get to that point. How Java can help you with C++ I can't see an example of. Unless you mean Java helps you with OO and structured programming.


-Leaks all garbage and bad code.

While it is true that in Java it is hard to create memory leaks, it is still possible. An because it is not easy to create them, they are hard to find when they do exsist.
The garbage collector is probibly one of the better features in Java since it takes care of freeing objects that you don't use anymore.


Cons: - uses a virtual machine to run apps so apps are slower then regular compilers.

While the lower speed was true for the early versions of Java, nowadays the difference between Java and C++ is very small indeed. Perhaps the only place where you need to worry about that is where you have a program which does HUGE amounts of computations. And even then it's not that big an issue, because if you really need to you can offload that part to a dedicated C++ DLL (if you really wanted to).


-Since it does not use machine code, programs will lag

Every program can lag, this has nothing to do with the language you use as much as how you code in that language. See my statement above about speed.


-Does not support amazing graphics

I take it this quote is derived from the most popular Java game out there, Runescape? I agree that the graphics in that game are crap. But that has more to do with the people making the graphics then with the programming language. I've seen some pretty amazing graphics done in Java, you should check out the game development forum on http://forum.java.sun.com/index.jspa


-Since it runs on a web page there may be critical errors on the web page, internet, computer causing a chrash.

Java applications can be run locally as well as in the form of an applet, there's even a third version, Java WebStart, which is kind of a mix between the two. It download the application from the web, and checks for updates automatically each time the application is run. But besides that, the application is stored on the local machine.


-Uses C++s more advanced features in simpler code but not as powerful nor does it have everything C++ has.

Java has come a long way compared to the documents you've been reading. Almost everything you can do in C++, you can do in Java nowadays. There are even full fledged 100% Java 3D engines out there.


C++
Pros: -Handles much larger programs and projects

I'm thinking you have no idea about the codebase for Runescape...


- Supports imported GFX,Direct X, Sounds with DLLs'

You can plugin just about any DLL into Java for which you have the header file. Which is basically the same as what you need to plug it into a C++ application.


-Uses CVS to organize everything, usefull for big game projects

Ever seen the amount of Java projects on sourcefarge? But then again, I guess sourceforge doesn't use CVS.


-Uses native machine code(compiles into binary code)

This is true. Although this also means you will have to have a seperate development tree for each operating system. If not for all the code, then at least for parts of it.


-Much more freedom and features.

What freedom and features are you talking about here? Like I said earlier, there isn't really that much I couldn't do with Java if I really wanted to. Partially due to the fact that I can plug in C++ libraries and use them to complement the parts Java doesn't provide in and of itself. Partially because Java has one of the biggest users bases in the open source community.


-All libaryes in C++ remove the hassel of detail

Like I said, Java has one of the biggest users bases in the open source community out there. This besides the fact that Java is probably one of the only programming languages which actively interacts with its user base before releasing new features to make sure they are exactly what they want/need.
Oh, did I mention Java itself is going opensource soon...


Cons: -Advanced code that takes time to learn
-Complex syntax lends itself to abuse
-Does not support APPs so must down load but much more organized and will not lag.
-Takes time, for each differnt level you make in C++ must me a source code, and many other files.

Cj Shadows
07-11-2006, 10:06 PM
Well tell u the truth this comes from the top of my head and I havnt heard alot about Java for along time. I dont know anything about the code base forRunescape but id like to, is there a place where i can learn? And sincei i have never used Java im am very interested in it, is there a stie where i can get a free java compiler and runtime envirment?

ractoc
07-13-2006, 07:39 AM
for free Java compilers you got 3 joices, Netbeans, Eclipse or JDeveloper.
Jdeveloper was made by oracle and is very oracle oriented. Netbeans and Eclipse are more general DIEs.
Of these two Netbeans is the one officially endorsed by SUN.
You can find Eclipse at www.eclipse.org (http://www.eclipse.org) and netbeans at www.netbeans.org (http://www.netbeans.org).

Shattered Skies
07-14-2006, 01:10 PM
I also use a program called Gel. Its more or less a simpler version of Eclipse and NetBeans. Of course you could always use good ol' notepad. Just google up Gel and you can find their homepage.

On another note....


And sincei i have never used Java im am very interested in it


Why are you making comparisons about two different languages if you never used one of those languages in the first place?