Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.






Java vs C++

Posted by cgpIce, 04 June 2012 · 1,334 views

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.




Hands down, C++ is better suited for PC games 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.
Updated with some more information.

Hands down, C++ is better suited for PC games 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.


Thanks, I am thinking I will most likely move to C++, and your opinion is further pushing me towards this path.
PARTNERS