49 XULRunner’s maiden voyage

Posted: Feb 20, 2006, under Cross platforms. Add a comment!

Slashdot announces the release of XULRunner 1.8.0.1, the developer preview of Mozilla Foundation’s XUL framework, now available for Mac, Windows and Linux. Do read the Slashdot piece, it offers links to many useful resources for those who want to get started developing in XUL.

It was about high time that Mozilla got their XUL platform out in the open and under the public eye. As seen from the Slashdot article comments, already the platform is under a fair amount of criticism. Particularly, it is compared to other similar technologies.

Let’s see what one ObsessiveMathsFreak has to say about this:

I would classify XUL as a good GUI development tool. It’s rapidity is quickly lost if one delves into any XPCOM backends.

True, XUL is very nice for RAD and cross-platform development, but if you really want you can shoot yourself in the foot and become just as tied to a specific platform or operating system as if you’ve had written your code in a platform-specific language all along. But hey, that’s equally valid for any language which can use OS-specific libraries, so let’s cut it some slack.

However, for simple, client side, frontend GUI operations, XUL is a very, very useful tool. It gives you the ability of DHTML in a way that isn’t a hack.
 
Here’s a good example of XUL’s layout capabilities. IN terms of pure layout, there not really that much here that is different from HTML. However when you get dynamic, XUL really shines.

Very nice examples. XUL is quite similar to “classical” DHTML, but with the added benefits of liberating the developer from the confines of HTML. Namely, you’re no longer restricted to the silly set of HTML widgets, forms and non-existent window model and can really go to town.

…but I’m betting 5 out of 10 people reading this didn’t get to enjoy the examples, because they weren’t using a Mozilla browser. Did you try to follow the links with Opera or Internet Explorer? Tough. Explorer offers to download the .xul file for you, while Opera renders the XML as plain text (due to the lack of XSL, probably). Which brings us to the next point:

People go on about AJAX, but XUL offers a huge amount of potential.
 
Personally, I feels XUL’s only achilles heel is javascript. That language needs a serious overhawl if anyone is to be able to use it without all that hassle.

Ah, not so fast there. JavaScript is a decent enough language. Elsewhere is the XUL Achille’s heel located.

AJAX may be a hack and restricted within the DHTML realm of possibilities. But it is widely available, now, in all the major browsers, at no extra effort from the user. People can pick up a copy of almost any recent enough browser and will still get to experience Gmail properly. Which cannot be said for those example linked above.

Thus, AJAX is much less hassle for the user. That’s a very important step towards larger acceptance. And if you don’t believe me, think how much of a blow things like AJAX and the Canvas extension delivered to Java applets. Even though applets are more powerful, the overall inferior solutions still kicked their butts in many places, purely because the things needed to run them were more readily available.

Support already in the browser? Great, you got it made. Need a plugin to make it work? Err, ugh, oh well, most people will eventually get around to installing it. Need a separate virtual machine? Um, I don’t really think… Is the virtual machine a hefty tens of megabytes download? Forget it!

The weak spot for all the cross-platform solutions is their need of some degree of virtualization, usually in the form of a virtual machine of some sort. In addition to making for big downloads, these VM’s are also reputed to run at least a bit slower than natively developed applications, and usually eat up a lot of system resources. Not something that users generally love about their applications.

It gets worse. According to the Mozilla development docs, for now at least, XUL developers are advised to bundle a separate runner with each XUL application! Indeed, come to think about it, all the Mozilla flagship apps (Firefox, Thunderbird, Sunbird) come with their own XUL platform.

Granted, this XULRunner is just a developer preview. At some point the runner will probably come as a single virtual machine, installed once, reused by all XUL applications. Much like the Java Virtual Machine. That is, if they want to stand a chance in Hell of making it big.

As a GUI application development tool, I would expect XUL and XAML to replace older methods such as GTK and *shudder* Windows “Visual” code. It’s faster, cleaner, makes more sense, and you don’t need 300 lines of code plus libraries to draw a hello world window.

For that matter, don’t put down GTK+ either. For one, GTK+ applications on both Windows and Linux are capable of using the same framework. I have Gimp and Gaim installed on Windows and only one GTK+ kit installed. Score one for GTK+ over XUL.

As for RAD development, GTK+ has Glade, something that even .NET or Java lack AFAIK: a way to describe pure GUI in clear XML, without depending on any proprietary format or software. I can design all the GUI in Glade and activate it in my GTK+-based application with a couple lines of code. So much for RAD supremacy in XUL.

Conclusions? The good:

  • It is a powerful platform, which has already proven itself with the Mozilla browser, Firefox, and a handful of other world-famous applications.
  • It is based on XML (big in both the exec crowd and among developers) and JavaScript (which any webdeveloper learned to some degree in their infancy). The learning curve should therefore be somewhat smoother.
  • It offers a truly cross-platform alternative, equaled by only Java, since the Microsoft similar products cannot be considered cross-platform with only Mono on the “wild” side.

The bad:

  • The need for a virtual machine (slow, cumbersome, you know the drill).
  • The need for several virtual machines.

An IDE which specializes in XUL wouldn’t hurt, come to think about it. Perhaps XULRunner itself aims to be one, seems to early to tell.

So, get XULRunner out as a single VM, available via a nice installer or native packages for all the major operating systems; relaunch versions of Firefox and Thunderbird as pure XUL packages running over this VM to prove the point; and then maybe developers will start coming in. This multi-VM hack is a very serious problem and it might hurt a lot in the long run.