RSS
7 Nov 2006

The Best Cross-Platform Toolkits and Environments: A Journey

Author: ceefour | Filed under: Opinions, Ruby, Tips

Java is a full-fledged platform and framework, and now it supports more languages including Ruby (using JRuby). Microsoft’s .NET has great and very speedy VM (Virtual Machine) in Windows, and also runs on other platforms using Mono CLR (Common Language Runtime; but never expect full support for full .NET Framework anytime in the foreseeable future). .NET also supports the Ruby language through YARV. The Ruby interpreter itself, of course, also supports developing cross-platform applications and with toolkits such as FXRuby and wxRuby, developing GUI desktop applications using Ruby can potentially be as enjoyable as developing Rails sites. The question is: Which technology should you choose?

 The Best Cross Platform Toolkits and Environments: A Journey

Note: I was trying to get the introduction + conclusion first paragraph of this article to be as concise, yet as conclusive as possible, but this time I failed… again. Hey, I’m far from being a professional writer, please bear with me for a moment. And I’m sorry if this article has very little (if nothing at all) to do with Rails, but it’s somehow Ruby-related, so I decided to post it here.

Since I “officially” switched from Windows to Linux (Ubuntu), I’ve been thinking a lot about cross-platform applications development. I practically use two operating systems everyday, with Windows being used inside VMware, and also at work (my office is exclusively Windows–but I’ll try to get my next assigned project developed using Rails, so I can use Linux, yaay!!). I have currently one personal desktop application that I actively use, a very superior contact management application tailored to my unique habits called GadoContacts. (yes, it’s very superior, much more than Outlook or Evolution, you’ve been warned icon wink The Best Cross Platform Toolkits and Environments: A Journey ) Problem is, it was developed using Visual Studio 2005, so it runs only under Microsoft .NET Framework, and it uses Access as its data store.

The decision why I used Visual Studio 2005 at that time was a no-brainer: It’s the most ubiquitously productive and easy way to develop applications on Windows. Access as the database is also practical: It’s very easy to use, doesn’t need any installation of a database server whatsoever, and it mostly sufficient as an lightweight database management system. I had once used SQLite as the database format, but proved to be more problems than it’s worth (if you want history, at first it used Paradox, the app being developed in Delphi, then it used Access, then it used SQLite, then back to Access again until now). I had once considered to use Microsoft SQL Server 2005 Express Edition but was glad I didn’t make the switch.

Cross-platform is not a problem before cross-platform is a problem? (whoever said that must be punished) The application runs fine in Windows, but it hurts me to run VMware and boot Windows just to be able to run this single application. I have to make this application (in the future) runs in Linux as well as Windows. I definitely expect a rewrite from scratch. The problem is not whether I’ll be porting or when… but rather, where?

Expectations

Before I start, I need to have some expectations/goals/requirements. Not strict, but all of them are desirable:

  • Native GUI. No, not Java Swing. Not GTK+ on Windows. I want cross-platform code, but native GUI widgets and components. This is largely toolkit-dependent than the development tool used. wxWidgets toolkit seem to be the only option (especially after considering other factors). wxWidgets is also usable from several languages.
  • Managed memory allocation. I’m through with access violations, memory leaks, and pointer stuff. I badly want this.
  • GUI Designer. Programmatic GUI is… not enjoyable. Not so Ruby way.
  • Interoperable. It can use libraries developed for other languages. Ability to use native C/C++ libraries is somewhat mandatory.
  • Optimized. Not only native widgets, but if many things can be optimized for the running platform, it will be great. Compiling to native code will be good.Somehow I don’t really expect “write once, run anywhere” but rather “write once, compile anywhere & run there”.
  • Access to multimedia features. Graphics, 3D acceleration, sound, video decoding and playback… Asking too much? Maybe. But definitely desirable.
  • Unicode support…

.NET

Of course, the app being developed in .NET, then .NET is the easy alternative at first. C’mon, you’ve got Mono, how hard can it be? Although the CLI (Common Language Infrastructure) is portable, and standardized (and Mono runs it), everything else in the .NET Framework is pretty much not, and in some way will never be (since they’re somehow designed to be native and Windows-only, or just either too Microsoft-ish or Windows-y). But it’s possible.

Personally, though, I’m not a very strong believer of .NET Framework’s future… But first let me clarify my statement. .NET Framework is very, very good (aside from some OO (object-oriented) engineering quirks that some of you architects hate). With the upcoming 3.0 version it just gets better. But it’s better… only on the Windows operating systems. And they’ll never be standardized. The Mono guys will have to work seriously hard to ever match the quality of .NET Framework implementation in Windows. You shouldn’t expect to write a full-blown Visual Studio 2007 app and expect that to work on Mono. C’mon, be a bit realistic…

Java

A very obvious alternative. It’s not so much an alternative as it being the primary solution. Java (I mean, the virtual machine for Java platform) runs on virtually all platforms you can imagine and even “the one[s] you should not name”. icon wink The Best Cross Platform Toolkits and Environments: A Journey

Java has all the goodies you could ever want: commercial support, great IDEs (and not just one: JBuilder, NetBeans, Eclipse, IntelliJ, IDEA, come on… there’s got to be at least one you can love!), lots of libraries (though not as many as C/C++ libraries, but they usually have different purposes), and a community that are so… loyal. (One of my friends’s boyfriend is a hard Java programmer, he literally ports Java frameworks to PHP!)

There are some issues with Java (as it is with any technology). My first consideration is the Swing GUI toolkit: I want native GUI, please! Another is speed (usually compared to C++), but this will improve in the future and this shouldn’t actually be a problem today: if you really want to trade-off productivity for execution speed, go get that assembler of yours. Another is the JVM (Java Virtual Machine), which is a similar problem shared by .NET apps: I don’t really like bulky VMs. But I guess that one is inevitable, after you’ve got the VM properly installed, you’re good to go. But you good to go doesn’t mean that your users are good to go as well. Bundling a 20 MB VM with your 1 MB app isn’t very tasteful, and giving a link to download the VM isn’t that nice either.

But still, I think Java has lots more good stuff than it has problems.

Ruby

Since Rails is only a “side-effect” of the existence of Ruby, I definitely should consider Ruby for cross-platform development. Writing in Ruby (the language) is a joy, and this is one plus side that none of the other alternatives have (especially C++). The Ruby interpreter is relatively lightweight compared to .NET/Java VMs. Several GUI toolkits are available, the most popular being FXRuby I guess, and the most interesting in my opinion being wxRuby.

One of the biggest problems with Ruby probably is execution speed, but this is being worked on and in the near future this problem will be “solved”. Ruby also don’t have that many supporting libraries when compared to C++, .NET, and Java… but there are Ruby alternatives and with some work and luck, you can even get these libraries from other languages to work with Ruby.

Another issue with Ruby development is RAD IDE (Rapid Application Development Integrated Development Environment) tools. I primarily use RadRails, it’s very good (based on Eclipse) but obviously will never compete with something like Visual Studio. icon wink The Best Cross Platform Toolkits and Environments: A Journey

Portability Libraries: wxWidgets, Mozilla, Apache Portable Runtime, BOOST, …

These are are portability libraries to develop C++ applications that target multiple platforms. Haven’t yet researched them. wxWidgets is currently my primary interest since it’s usable from other languages (including Ruby, though they say it’s not very stable yet).

GUI Toolkits: Swing, Qt, wxWidgets, FOX, GTK+, … Windows Forms? (want to include Windows Presentation Framework?)

Somehow I immediately excluded all of the toolkits available except wxWidgets, since one of my goals is going native at least for the GUI part. For Java though, Swing is somewhat unavoidable, but looks like wxWidgets work with Java too!

To Be Continued?

I’m not conclusive yet. imeem chooses .NET/Mono + their own toolkit for providing native GUI desktop applications to multiple platforms. There are lots of people who already choose Java. Using JRuby to create Ruby applications may be attractive. Using the Ruby interpreter directly to power GUI desktop applications though, is still “unproven”.

So, what’s your take?


Technorati : , , , , , , , , , ,
Del.icio.us : , , , , , , , , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.