What is Larry Thinking? #5 => Introducing Adobe AIR

October 1, 2007

In this edition…

About this Newsletter

First, my thanks, as always, to those that provided feedback on the previous newsletters. Your comments really help to make this newsletter useful. Please keep your questions and suggestions coming.

As always, older newsletters are available online and you can also use the corresponding forum to start any discussions.

My apologies for the delay in getting this one out. It’s been over five weeks since the last edition. The delay is in part because I’ve been burning the midnight oil writing the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide”. Secondarily, I knew I’d be receiving my copies of my most recent release–“Building a Web Site with Ajax: Visual QuickProject”–and I wanted to give those away.

Besides those two pieces of information, which are both elaborated upon later, this newsletter addresses the continuing topic of avoiding spam (which cannot be discussed too frequently) and finally contains a little bit about an exciting new technology, Adobe AIR.

Q & A => What is a JavaScript-free, universally accessible no-spam solution that allows people to contact you through a Web site?

In previous newsletters I have written about how to avoid getting spam sent to your email address. One cause of spam is if you have your email address available in plain text in the HTML source of a page. Robots can find and harvest these values. Among the possible solutions include using JavaScript to obsfucate the address or using images to display it (I use the latter on my Web site). The problem is that the first solution won’t work if a person has JavaScript disabled and the second won’t work if using a text reader that doesn’t support images (e.g., devices for the blind or command-line utilities). One reader wisely asked if there wasn’t a universally accessible and reliable solution. Of course there is…

The answer, ironically, is not to list email addresses in your Web site in any way whatsoever. Not in plain text, not in obsfucated JavaScript, not in images. This does introduce the (rather large) problem that now no one can contact you via email. The workaround is to use a contact form that’s handled by PHP. Using this method, you can still receive emails but the actual email address is safe and sound. If you look around online, you’ll see that many sites are now using this method. This does introduce a tangential problem of your contact form being used to try to send spam, but there are easy fixes for that. One is to use some sort of CAPTCHA, like asking a simple question that could only be answered by a human (e.g., “What is the third word in this question?”). Another solution is discussed in this forum thread .

What is Larry Thinking => Introducing Adobe AIR

Since March (I think), I’ve been working on a Visual QuickPro Guide on a new technology called AIR, released by Adobe. I think it’s very exciting technology so I wanted to provide a little introduction to it here. I’ve already seen a fair amount of confusion as to what AIR is or is not, so I’ll try to make this as short and simple as possible. (As an aside, in its alpha release, AIR was known as Apollo.)

First, AIR is a technology for creating desktop applications. It is not a server technology and it doesn’t run in a Web browser. You create graphical programs in AIR, ones that can interact with the filesystem, perform networking tasks, and much, much more. Second, AIR creates cross-platform applications. With only a few exceptions, the same program you develop on Windows can also run on Mac OS X and on Linux (Linux support is expected to be enabled in version 1 of AIR). The cross-platform support is a great advantage of AIR, as anyone that’s created applications in other technologies–C, C++, C#, Visual Basic, etc.–understands that this is a major hurdle, if not downright hard.

Third, and this is also a huge benefit, these AIR applications can be developed using the same technologies you use to make Web pages (this is where some confusion comes in). AIR applications can be written using one of two technology families (or combinations of them): Flash/Flex or HTML/JavaScript. In the Visual QuickPro Book I’m writing, I show how to use HTML/JavaScript. So, in short, what AIR means is that if you can make a Web page, you can make a cross-platform application. That’s powerful stuff.

But as anyone that’s created a Web site using HTML and JavaScript knows, there are a couple of bugaboos that keep cropping up. The biggest pain is that different browsers support and interpret JavaScript and HTML in different ways. Well, that’s not an issue with AIR. Every operating system will use the same HTML and JavaScript interpreter, so the look and layout will be consistent and the JavaScript will always work (JavaScript could not be disabled by the user in an AIR application, either). The second issue with HTML/JavaScript are their limitations. In their own right, you can’t do much with HTML or JavaScript, certainly not compared to a real application. But AIR includes some frameworks that provide for extended features, like communicating with a database (SQLite, which is included), interacting with the filesystem, and so on. This means that you can, with AIR, make your own iTunes-like media manager or create your own text editor or even build your own Web browser.

Being able to use the technologies you’re already familiar with–HTML and JavaScript–to create beautiful, cross-platform applications is a wonderful idea, in my opinion (and no, I’m not associated with Adobe in any way). And I believe AIR has the right tools and support to make this work. In writing this book, I have the same feeling about AIR that I did about PHP when writing my first PHP book back in 2000.

How AIR Works

An AIR application is written in Flash/Flex or HTML/JavaScript (or a combination thereof) and is then packaged together using a special development tool (that’s free). The package can then be distributed and installed on user’s computers. The size of the package will depend upon the application, but you can do a lot with less than one megabyte. The AIR application is executed on the client’s computer through the AIR runtime. This is something the user needs to install on their computer once, then they can install any number of AIR applications. The runtime itself is operating system-specific, but an AIR application written on any platform can then run through this runtime on any platform (with a few exceptions). AIR applications can even install the AIR runtime for a user if it’s not currently installed.

AIR vs Java vs JavaScript frameworks vs PHP vs Google Gears vs Silverlight

In my opinion, the closest technology to AIR is Java, in that a Java application is also theoretically platform independent and runs through an already-installed runtime environment. Java, of course, is a full programming language that isn’t easy for everyone to pick up. And Java applications are notoriously slow and bloated. Some people have suggested that AIR is a rival to JavaScript frameworks, but that’s not the case. AIR runs separately from a Web browser and AIR applications often will use JavaScript frameworks for added functionality. As for AIR vs. PHP, these are two more or less unrelated technologies. AIR is a client-side technology for developing real applications; PHP is a server-side technology (although it can be used to create client-side programs, it’s a bit of a stretch). Running PHP requires a PHP installation, and often a Web server. So AIR and PHP aren’t really competing or related, although it is possible with AIR to interact with a Web site written in PHP (for example, a Web site could send out data in XML format that an AIR application reads and uses).

For those of you that have heard of either Google Gears or Microsoft’s Silverlight, both are interesting comparisons. These technologies extend Web browsers by adding application-like functionality. However, both are still browser-based. A closer comparison to Adobe AIR is Microsoft’s Windows Presentation Foundation (WPF). As far as I can tell, WPF is fairly similar to AIR, although it only runs on Windows.

Adobe AIR: Visual QuickPro Guide

I’m currently working on a Visual QuickPro Guide to Adobe AIR. It will be a soup-to-nuts guide to everything you need to know to begin developing AIR applications today. The focus is on using HTML and JavaScript (not Flash/Flex). And instructions include how to develop using basic, free tools you might already have (i.e., a text editor), using a wonderful and free IDE called Aptana, and using the AIR Extension to DreamWeaver. The first couple of chapters have already been completed, covering installation and creating a simple program. Those will be available online through Peachpit’s Rough Cuts series (on http://safari.informit.com). The book has been briefly delayed the past couple of months while I work on my PHP & MySQL book and await the next beta release of Adobe AIR (expected any day now). The goal is to have the book published around the first of the year (2008), which will be approximately when the first official release of AIR comes out.

Book Giveaway: Building a Web Site with Ajax: Visual QuickProject

You must be subscribed to the newsletter to qualify for the book giveaway.

My Book News

As already said, my “Buildling a Web Site with Ajax: Visual QuickProject Guide” is now available. It’s a different style of book for me, with more direct instruction and less explanation and theory. The code, I believe, is quite solid and reusable, which should result in a reliable Ajax experience for the end user. It looks like Amazon is selling it for $13.59 (as I write this), which is a good deal (one of the many reasons I like writing for Peachpit Press is that it’s nice to have good computer books available for under $20).

And my Adobe AIR book is in progress. Chapters will be posted in rough format for download through Peachpit’s Rough Cuts series. More on this when I have details.

Finally, I’m pleased to report that I’ve hit the half-way mark of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide”. The book uses PHP 6 and MySQL 5, so should be the book to have for the future of both technologies. Most of the new material focuses on new features in both technologies. Overall this means making more universal sites: supporting multiple languages, multiple time zones, and so forth. One new example chapter is being added, using a forum/message board (a popular request). The book is on schedule to be out by year’s end.