First Impressions Of Programming With Adobe AIR

(Originally posted 2008-06-25.)

Many of you will have, by now, installed the Adobe AIR runtime. Most probably it will be to run something like Twhirl.

At this point many of you will be asking “what’s Twhirl?”

If I said it was a nice desktop application that makes using Twitter so much easier I hope you don’t ask “what’s Twitter?” 🙂

So, we’re beginning to see these desktop applications coded using Adobe AIR, which stands for “Adobe Integrated Runtime” (formerly “Apollo”).So, what’s special (if anything) about AIR?

In my experience, two things:

  • AIR applications run across Mac, Windows (and in Alpha form) Linux.

    (In fact I installed the Linux AIR alpha plus Twhirl on my ASUS EEE PC some months ago. (Nice machine that EEE, by the way.) It worked fine within the limitations of the AIR alpha code.)

  • It’s entirely possible to code up AIR applications using just a text editor. (in fact that’s precisely what I did.)

    My editor of choice, for whatever that’s worth, is Notepad++ on Windows. (And I’d rather not start an editor war here, thanks.) 🙂 And the EEE comes with the Kate editor, being built on Debian Linux.

    I like environments where there is little, if any, in the way of barriers to entry for programmers.

So what does an AIR application consist of?

In principle one can do fancy things with Adobe Flex Builder and .SWF files but that requires expensive tooling. But there is another way:

You can write an AIR application of arbitrary complexity with two files:

  • A small XML file.
  • Your HTML file which can also have javascript in, just like normal web pages. In fact your typical AIR HTML file could be thrown straight into a web browser and work just fine.(That is unless you use some of AIR’s special capabilities – which your javascript can detect the availability of and code around accordingly.) And I assume that when I say “your browser” I mean a standards-compliant one like Firefox. 🙂 Note: The flavour of AIR that uses HTML / Javascript is actually built around the Safari browser.

    So I really think the “this builds on what you already know” point makes it attractive to an awful lot of people.

This isn’t an AIR tutorial so I’m not going to give you samples of the small XML and html files. You can easily find those on the Web. I just want to leave you with the impression there isn’t much to it. And there is an O’Reilly pocket guide for AIR. (But there isn’t a “For Dummies” book for it – so that’s alright.) 🙂

There are alternatives – such as Mozilla’s XULRunner (whose user interface is based on XUL rather than HTML) and, I suppose, Microsoft’s Silverlight. But neither is as easy and “I just need a text editor and the SDK to do it” is pretty enticing.

So, I’m impressed at its simplicity, the fact it builds on HTML, XML and Javascript. And if you want to be able to build something that looks like a desktop application, complete with drag-and-drop and clipboard capabilities, this may well be a good fit for your needs.

I mentioned the SDK. It’s free (but it doesn’t run on Linux and I’ve not heard any suggestion that it will). It comprises two useful tools:

  • ADL – which you use for testing
  • ADT – which you use for packaging up your completed application. This involves signing the resulting .AIR file – and the ADT tool has the capability to enable you to be “self certifying” so that gets round the cost of getting a certificate from a more formal authority. But it does require users to trust you. 🙂

Both are simple to use.

So, I got a “Hello World” application up and running in about twenty minutes, and that even with typ(o)ing in the XML and HTML files from the O’Reilly book. Swiping from the Web would probably be quicker – but you’d learn less.

And now I’m proving remarkably productive at writing a full-scale application. What’s slowing me down – if anything – is my very basic CSS. And this application uses XMLHttpRequest and walks the DOM tree to build the window contents on the fly. All using standard javascript. Oh, and my CSS is rather more under control. 🙂 I just need to refactor it into multiple parts as all my CSS / HTML / Javascript is in the one file. Oh, and then there’s refactoring to use dojo. I’m told you can use dojo in an AIR application, so long as you ship the dojo runtime with it.

If you want to know more about AIR go to their blog. For Twhirl go here and, of course, Twitter is here.

Note: IBM doesn’t appear to have any commercial interest in AIR. And I certainly don’t. So I’m just telling you how I see it.

Published by Martin Packer


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: