Java vs C++

posted in Dukandia
Published June 04, 2012
Advertisement
Hello,
Right so let us redo this. Java and C++ are very similar in syntax but what really makes them different? I will go over some of the differences in as much detail as I am aware, I will then ask that you post your opinion of what language would be best for a computer game. The results of your opinions, my team's opinions, and the information provided will influence Dukandia's progress.

Design:
Before we can talk about the very in-detail parts of C++ and Java, we must first talk about why they were first created:

  • C++ was designed for systems and applications, it was an extension of the C language. It was designed for efficient procedural execution.
  • Java was designed as a system to interpret printing systems, but later grew to do much more. It uses virtual machine to make it portable and secure. Although it has similar syntax to C++ it is not compatible in any way.


Compatibility

  • C++ is of course compatible with C, of course exceptions do apply.
  • Java is not compatible with any programming language.


Portability

  • C++ is write once, compile to run anywhere
  • Java is write once, run anytime anywhere

Syntax

  • Parsing C++ can be more difficult, C++ allows namespace level functions, variables, ect. Lastly C++ objects are values.
  • Java has a context free grammar that cane be parsed by simple parsers. Java entities must be given a type and be defined as such.

Running applications

  • C++ is compiled directly into code your operating system can run
  • Java is compiled into code the Java Virtual Machine reads and interprets at run time

Templates vs. Generics

  • C++ uses Templates
  • Java uses Generics

I would delve into more detail but I'm not really good at going over everything if anyone wants to step up let me know and I'll add it in.

That's as much as I know for comparison really.
0 likes 2 comments

Comments

Ashaman73
Hands down, C++ is better suited for [i]PC games [/i]in my opinion (think for console too , for mobile use java instead). You have a performance gain (ok, not much), direct data manipulations are more flexible, you can overwrite operators (very nice when you want to do matrix/vector arithmetic), most third party libs for games provide a C++/C API (for java it is not always available), templates are much more powerful than generics.

Thought java comes with really powerful framework out of the box (many libraries), most of this functionality is not needed in game development.
June 05, 2012 05:12 AM
cgpIce
Updated with some more information.

[quote name='Ashaman73' timestamp='1338873161']
Hands down, C++ is better suited for [i]PC games [/i]in my opinion (think for console too , for mobile use java instead). You have a performance gain (ok, not much), direct data manipulations are more flexible, you can overwrite operators (very nice when you want to do matrix/vector arithmetic), most third party libs for games provide a C++/C API (for java it is not always available), templates are much more powerful than generics.

Thought java comes with really powerful framework out of the box (many libraries), most of this functionality is not needed in game development.
[/quote]

Thanks, I am thinking I will most likely move to C++, and your opinion is further pushing me towards this path.
June 05, 2012 03:48 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement