Qt > Java

Why do we keep using Java? It is full of security holes, slow (at least for many Swing-based GUIs), uses non-standard OS controls (like its file-browsing widget), requires updating every other week, and now Oracle bundles the Ask toolbar with updates!

Java bundling Ask Toolbar

Java bundling Ask Toolbar on Windows 7

What do we get for all this pain?

The promise is “Security. Write once, run anywhere.“.

We can just toss the promise of security. Java security has been broken for a long time, and it shows no sign of being fixed. The “write once, run anywhere” promise is not true either. We can write once and run anywhere… that has a Java Virtual Machine installed. You know that thing that Oracle updates every 2 weeks and attempts to bundle Ask toolbar? That’s the JVM.

So it needs JVM, but everybody has Java, right? Well, for about a month, I didn’t have Java (had to reinstall Windows). Yes, it was just a download away. Still, even if our end-user does have Java, they may have the wrong Java. Java is highly version-specific. Our app may run on a different version than what the end-user has installed. And don’t even get me started on the huge pain Java versioning causes when trying to get Eclipse/Netbeans configured correctly. My recommendation to upcoming Java developers is to capture your development environment in a virtual machine. That way, if you need to migrate your workstation, you just copy over your VM. I would do at least one git check in of the whole vmdk file. Trust me.

Perhaps we are willing to put up with this craziness because in the end, the JVM is free and runs pretty much everywhere. Yes, it has problems, but it is “good enough”. We simply don’t have time to write everything with Windows C# and then again in Apple Objective-C.

No we don’t time, but my fellow developers, we don’t need to. There actually is a very good alternative. It is called “Qt“. Instead of “write once, run everywhere”, their promise is “Write once, COMPILE everywhere.” We can write our app just one time, using C++, and then we just compile it to each platform. There is no “byte-code” nonsense. Everything is a binary running full speed. The Qt libraries translates our app so various widgets like the file browser looks much closer to OS-native.

Setting up the dev environment is very easy. Qt Creator is a very nice IDE. When we build our app, we can bundle the linked libraries so the end-user always have the exact version that your app was compiled to use. (Use dynamically linked. Qt is LPGL.)

Qt is not new. It has been around for 20 years. Well-loved apps like VLC Media Player, Google Earth, and Autodesk Maya all use Qt. Next time we are starting up a cross-platform app, before we launch Netbeans, give Qt Creator a chance. These days, the only time I use Eclipse is for Android development (the only reason I re-downloaded Java BTW).

There. I’ve said my piece. Next, if I need to get everybody to dump Flash for HTML5. I still do not have Flash installed since reinstalling Windows. I hope I never have to.

Posted in Editorials, Featured, Programming
2 comments on “Qt > Java
  1. Ivan says:

    > These days, the only time I use Eclipse is for Android development
    > (the only reason I re-downloaded Java BTW).

    BTW, Qt 5.1 will have support for Android: http://blog.qt.digia.com/blog/2013/03/13/preview-of-qt-5-for-android/

  2. dan says:

    Yes, but it looks like it requires the user having Necessitas installed or whatever the 5.1 equivalent will be called.

    Maybe that won’t be a big deal once 5.1 is out and Necessitas becomes widespread, but I don’t want to send off my users to download a library. What’s really nice about Qt for desktop is I am able to bundle the libraries via the LGPL, so the user just runs one installer. The fact that Qt libraries are used is completely transparent.

Leave a Reply