4 ms·
First, I want to say that irrespective of its flaws, the JVM is an awesome piece of software. There's lot of really exciting work still going on: G1 collector,
by strlen 16y ago
First, I want to say that irrespective of its flaws, the JVM is an awesome piece of software. There's lot of really exciting work still going on: G1 collector, Azul's open source contributions, register based Dalvik VM. Ten years ago few people would have imagined distributed databases running on the JVM that are fast enough to saturate the network, industrial scale JVM based HPC and running 20gb sized heaps under heavy production load without any GC-related problems in sight. On another note, few people would have imagined Scala and Clojure either. So don't take what I am about to say as a "yet another rant from a developer bashing his tools" rant.
There's great deal of optimization going into the JVM as a server-side VM, but unfortunately, there's less work going into the JVM as a client VM. Lot of the advanced options that exist on the server version of HotSpot aren't available on the client version. Azul's recently open sourced tweaks are also aimed at the server side market.
I fully understand the reason for this: Microsoft dominates the "thick client" market, the money for Java is on the server side (with Javascript client code running in the browser). The few Java desktop apps that I use are development related: Yourkit profiler, JVisualVM, IntelliJ, Processing-based Arduino IDE and Eclipse CDT (for the excellent AVR plugin). They're actually excellent, but (with the exception of light-weight Processing/Arduino IDEs) they're aimed at developers who are familiar with the Java platform and don't mind occasional rough edges: I had to tune IntelliJ's GC settings (enabling CompressedOops on 64-bit Linux, using a 32-bit JVM and CMS collector on OS X, adjusting sizes of various generations etc...) to get it to stop locking up on me. Given I work on memory intensive Java and Scala applications, that's not a problem for me. Imagine, however, a word processor application that required this ("hey mom, it really is called `CompressedOops', one word, capital C and capital O!").
On the other hand Qt provides many utilities for C++ beyond the UI and has bindings for Ruby. It's cross platform between OS X, Linux and Windows. Qt and C++ would be the route I'd take were I to build a cross platform application I am skilled enough with valgrind and honestly don't find lack of a GC to be a major problem for me (especially for desktop programming, which doesn't frequently involve complex parallel algorithms that are difficult to implement with manual memory management). Qt's provides a great deal of what one expects from a high-level platform like the JVM: concurrency libraries beyond primitives, simplifications for building event/callback driven applications, additional collections and even an IoC container.
If I didn't mind tying myself to Microsoft's standards, I'd also take a serious look at Mono: while Mono's GC is primitive compared to HotSpot when it comes to server side applications, I've yet to hear of people having to tune it in order to run Mono-based desktop apps such as (excellent) F-Spot; garbage collection is a long-ago solved problem, I find it hard to believe that client VMs couldn't come with sane defaults out of the box. In this way it reminds me of Linux in mid-90s/early 00s (before distributions like Ubuntu and extensive driver support): lot of work going into scaling to thousands of processors and new architectures, while getting support for desktop sound and video cards required recompiling a kernel.
Finally, the author really strikes a point with lack of a POSIX API built in to the JVM. What's even more striking is that this can't even be explained by "focus on enterprise server market" theme. Server-side, Linux is almost a mono-culture with occasional use of Solaris or OS X (the latter frequently as development environment). The few non-POSIX platforms (Windows, mainframes) aren't really a large part of the Java market and have POSIX compatibility layers available for them (bonus point: why not support both, like Perl does -- having builtins for most system calls, but also an excellent Win32 module).
POSIX-JNA is available and (from what I hear) is an excellent library, but its use of GPL makes it incompatible with Apache-licensed projects (ASL 2.0 being de-facto standard in the Java world). A minimal interface to POSIX, coupled with a "systemcall()" method (allowing easy use of Linux-specific extensions) should be the standard part of the JDK: Python and Perl offer this without sacrificing portability and safety, why can't Java?
- nl 16y agoI'm not sure this is what you want to hear, but you might as well give up on Java on the client. No one cares anymore. The only big company shipping client-side Java software applications is IBM, with Eclipse and their other Eclipse-based products. Oracle quite plainly doesn't care, and without significant investment it's just not worth the pain anymore. I'm a Java developer, and I've recently been looking into developing a cross platform client app. Java just isn't a serious player - the reasons why I'm looking a client app (basically hardware access) are exactly the areas Java is spectacularly weak in. (I'm excluding Android from this, because that is a special case)
- strlen 16y agoI entirely agree with you re: "but you might as well give up". If I had to build a cross platform desktop app, I would use C++ and Qt, which seems like the most sane option. Android/Mobile is certainly a separate case.
- borisk 16y agoThe most sane option, really? You'll use a runtime without garbage collection. And a GUI framework, vastly inferior to say WPF ( GUI accelerated, XAML DSL, tools for designers ).
- strlen 16y agoI said "sane" not elegant or beautiful or "best in every occasion". I'm also speaking in terms of cross platform. .NET is an excellent platform for Windows development and I won't dispute that. I am very well aware of Mono, but it still involves tying myself to a Microsoft standard (plus it's always going to be behind in terms of both language and libraries). As I've mentioned earlier, I am fine without garbage collection for desktop applications (implementing complex parallel algorithms is a different matter -- there GC very clearly helps). Sure GC is very nice to have even when you can make do with manually finding/fixing leaks (I'd rather focus on something else), there are many other advantages to high-level languages than just garbage collection (actual RTTI/reflection -- not very possible in C++, richer built in collections, callbacks without function pointers or "operator ()"; in the case of Scala, F#, Lisps -- and to a lesser degree C# -- there is functional programming, closures, DSLs, etc...)