Quote:
Originally Posted by Hezzy002
Perl is still widely used, mate. Doesn't mean the reasonable people like it.
EDIT: Not really saying that I have any huge issues with Java. The biggest qualms I have are in regards to the GC (Something I only want to see in an embedded scripting language), lack of operator overloading (Something useful that helps continuity), and the fact that everything requires a wrapper class (Hardcore OO is counter productive to a purely functional program).
Most of my opinions are also heavily based on game development. The language and VM just isn't suited to it IMO. There isn't a lot of middleware for Java, low-level functionality is out the window, and even though the VM executes relatively quick because it's JIT'd, GC is a huge bottleneck. Imagine if CoD had stuttering ingame as the Java VM frantically searched through memory to try to find some available to allocate and others to free (Not multithreaded, pretty sure it's impossible to do completely asynchronously).
Also can't handle an object's memory directly (Super useful for parsing binary file formats; just pointer to file data -> struct in the same format and the header's parsed), can't even shallow copy objects automagically (memcpy would work in C).
Sure, these issues wouldn't crop up for a lot of programming projects, but they cropped up hundreds of times for me when I was trying to make a game engine in Java, and pretty much every game developer I know hates Java and JVM with a passion.
|
It is true that there's really nothing you can do once GC kicks in, but I've read several studies showing that programs with GC can often outperform direct memory management. This is particularly true for long-running processes. A good read is this
article, which claims "dynamic memory management is not as fast [as direct memory mgmt] -- it's often considerably faster." It also states that between 92 and 98 percent of the time, GC merely has to bump a pointer. There was one study in particular I wanted to point out, but the link appears to be dead =(.
Also,
JNI can alleviate most of the issues with low-level functionality, but if you're developing an application that requires a lot of low level processing, you shouldn't be using Java in the first place. This doesn't mean it's a bad language, it's just not what it was designed for.
You are right that Java is not ideal for game development, but if you know what you're doing, it definitely wouldn't be as big of an issue as you're making it out to be. Take a look at
libGDX, for example.
Java, like any other language, has its pros and cons. A few cons being the large memory footprint (if you include the JVM) and slow startup times (loading JVM, JIT compilation, etc). A few pros being readability, the relative easiness to develop applications quickly (because it's so high-level), compatibility, JIT compilation which can perform machine-specific optimizations and even further optimizations as a result of run-time statistics gathered by the JVM.