Java and C++

Started by
8 comments, last by stormrunner 19 years, 7 months ago
Is Java taking over? Someone told me about how it was the "new" language so to speak, but I don't understand how that is possible. It doesn't seem to have the power of C++...?
Advertisement
Nah, Java is good for some things, C++ for others. Bigots either say that Java is future technology, and C++ is too easy to screw up with, or Java is too slow and controlling. If you're getting into game development and want to use a next gen language that doesn't limit you as much, try C#. I prefer C++ though because it's what I learned.
why c#? it's basically microsofts version of java(notice the naming conventions are the opposite).
forgot to login
There are a lot of things different about C# and Java. Syntatically, there are very similar due to their shared roots in C/C++ but under the hood the are in fact very different beasts.

People say that Java and C# are the wave of the future so to speak, because the technology behind them are able to do a lot more fancy stuff and know a lot more about the actual run-time environment than any compiled code from C++ ever will. Although still in its somewhat infant stages, launguages such as Java/C# and their underlying technology, have great potential.
C# is still in its infant stages, but Java is just infantile. [grin]

Sorry, had to make the joke.

What I really wanted to say is that C# is far from MSFT's version of Java. It'd be more appropriate to say that .Net is MSFT's version of the Java Virtual Machine. However, unlike the JVM, .Net was designed to be language-agnostic, and friendly to any object-oriented language (you can even do .Net apps with Perl or Python). The JVM was designed around the Java language, and both language and virtual machine suffer from what is now thought of as poor design. (It's old, so I'll at least say that at the time, the ideas were pretty sound.) .Net has its own problems (apart from the whole 'MSFT is evil' slant), but by far and wide they were able to learn from Sun's mistakes with classic Java.

Sun, too, hasn't been laggard. J2SE 1.5 has introduced generics, which we won't really get in .Net until 2.0. However, considering that generics has been one of Java's problems from the beginning, but with possibly trivial fixes (Java Generics are pretty much just compiler-side type safety), it was poor form to not see them in .Net 1.0.

C#, by the way, is merely a language. One designed to be able to use all the features of .Net without too much trouble, but just a language. Like Java, it's purely object-oriented (unlike C++ or VB.Net, which are based on a procedural language base), and shares a syntactical history with C. However, they are two quite different languages, with different purposes, and saying that C# is just MSFT's version of Java is an insult to both languages and platforms.

Thank you for allowing me to waste your time with all this. In short, C# is not Microsoft's version of Java. The entire .Net framework plus languages is Microsot's version, if anything. And that's only if one wishes to view it that way (which I don't).

Chris 'coldacid' Charabaruk – Programmer, game designer, writer | twitter

Personally, I think that C# will have a major impact on the PC market in the near future, because I believe the code is compiled the first time it is run on the machine in C#. In this way, the code is specificaly optimized (in theory) for the type of machine you have.

However, I think that the console market may still be dominated by C++ for quite some time. When programming for a console, you know exactly what type of machine the code will be running on, and you can specifically optimize it acordingly.
An interesting piece on the topic.

Quote:Original post by coldacid
However, unlike the JVM, .Net was designed to be language-agnostic, and friendly to any object-oriented language (you can even do .Net apps with Perl or Python).


There exist several languages which can be compiled to JVM bytecode. Although that's different from saying it was *designed* to support those languages, true.

Quote:(Java Generics are pretty much just compiler-side type safety)


I assume you meant "compile-time"; and it's all they really *need* to be. Templating on values would be contrary to the Java design philosophy; better to add the value as a class member (or add a parameter to the function, or wrap it up in a new class). While it's true that you don't get the flexibility to do "ad-hoc polymorphism", and it's one of the things I don't like about Java, it's intended to protect against accidental collision of things. Consider:

template <typename T>void downsize(std::vector<T> employees) {  for (vector::iterator i = employees.begin();       i != employees.end(); i++) {    if (i->age < 30 || i->age > 65) i->fire();  }}vector<Gun> myGunCollection;downsize(myGunCollection); // guns don't kill people, people kill people.


Of course, to prevent this, you have to do a lot of extra typing for interface declarations and so forth, which is what I don't like about it. But then, I tend to avoid all of this anyway by preferring composition and delegation rather than inheritance schemes.

Quote:C#, by the way, is merely a language. One designed to be able to use all the features of .Net without too much trouble, but just a language. Like Java, it's purely object-oriented (unlike C++ or VB.Net, which are based on a procedural language base), and shares a syntactical history with C.


I would prefer to say, "Like Java, it supports an OO style of programming better than C++ does." There are ways to escape from it in Java, and probably even in Smalltalk. Bad programmers can write bad code in any language; Real Programmers(TM) can write FORTRAN in any language.

Quote:However, they are two quite different languages, with different purposes, and saying that C# is just MSFT's version of Java is an insult to both languages and platforms.


Please elaborate. It is difficult to accept this claim blindly given what I've heard about C#.
Hi.

I just wanted to add a few things aboug Java vs C++. With computing power these days (machines in the ghz range!), speed seems less and less an argument. Of course this probably wouldn't be true if you wanted to code Doom3, but as an amateur/independant developer, I think it has a lot of pluses:

-cross-platform development for free allows you to reach a broader audience
-call-stack given to you everytime it crashes with needing to run in a debugger(helps so much with debugging)
-garbage collection
-good language for beginners (imo at least)

Another thing to consider is that a lot of graphics computation can be offloaded onto the GPU.

-j
Jonathan Makqueasy gamesgate 88[email=jon.mak@utoronto.ca]email[/email]
Quote:I just wanted to add a few things aboug Java vs C++. With computing power these days (machines in the ghz range!), speed seems less and less an argument

its also a poor excuse for lack of knowledge or coding skill. i can write a program in c++ that is slower than the same written in java, and visa versa. making a conclusion from either proves nothing.
c# and/or java is not going to completely replace( if at all) c++ - c++ hasn't yet replaced(or dimmed the popularity of) c, and c hasn't completely erased fortran. god knows cobol and basic lurk in the underworld, somewhere. i lose sleep over it.
- stormrunner

This topic is closed to new replies.

Advertisement