Rich Internet apps that double as desktop apps
- 03 February, 2009 09:15
Finding a single development environment for all purposes has so far proven an unattainable goal. But with the advent of rich Internet applications (RIA), development nirvana gets a bit closer.
In the past year or so, a number of cross-platform RIA technologies have been released that can double as desktop application technologies. I'll discuss four technologies that accomplish this trick: Adobe Air, Curl Nitro, Google Gears and Microsoft Silverlight. I installed them all, explored them and used them for several months in the course of my work.
Air adds a number of desktop-specific classes and components to Adobe's base Flash and Flex classes. Air 1.5 applications can update themselves, interact with the system clipboard, use the file system, use native windows and menus, use a local SQL database and store encrypted data. Air also supplies a number of capabilities to the desktop environment for which Flash and Flex applications normally rely on the browser -- for example, HTML rendering, HTTP handling and network detection.
Publicly available Adobe Air applications at the Air Showcase range from simple desktop widgets to full-blown applications. Air is supported for development and runtime on Windows, Mac OS X and Linux.
I am more of a Flex and AJAX developer than a Flash designer. I found the Air extensions to Flex fairly straightforward to learn and use from Flex Builder, although I would have been happier if the Air documentation were included in the Flex Builder help file instead of only being available online.
Air runtime, Air SDK, Flex 3 SDK and Aptana Studio are free. Pricing for Aptana Studio Pro is US$199, US$699 for Adobe Flash CS4 Professional, US$249 for Adobe Flex Builder 3 Standard, US$699 for Adobe Flex Builder 3 Professional and US$399 for Adobe Dreamweaver CS4.
Nitro is the cross-platform desktop extension to Curl. Currently in its second beta-test release, Nitro adds an applet installer, desktop controls and a client-side SQLite database to Curl's excellent RIA capabilities. Nitro applications take advantage of Curl's high-performance, skin-able user interface and built-in security sandbox. Even without Nitro, detached Curl applets can be used for desktop applications: The Curl IDE and help system are good examples of that.
Curl may not be as familiar to you as the competing products from Adobe (Air), Google (Gears) and Microsoft (Silverlight), but you shouldn't let that deter you from trying it. It has CPU-bound runtime performance roughly 10 times that of Adobe Air , according to a test of JPEG encoding conducted by Curl in May. (The test was pooh-poohed as "irrelevant" by Adobe , but not refuted.)
In addition to high-computing speed, Curl has (according to my own speed tests) very high-performance graphics, at least on the Windows platform when using DirectX. It also has demonstrably strong security. (Curl has criticized the Adobe Air security model as having a huge hole in its signing certificate scheme.)
The Curl language may be new to you, but it isn't hard to learn. In addition to providing copious documentation , Curl supplies many excellent samples with source code, a number of interactive tutorials on application-specific topics called Curl Cues , a Curl IDE Made Easy interactive training program and online courses on the Curl language, the Visual Layout Editor and the Curl application development process.
Page BreakI was initially baffled when I looked for the Nitro extensions in the current Curl IDE documentation. Then I looked at the source code for the three Nitro samples supplied on the Curl Web site, and that made it clear where to find the Nitro functions in the Curl libraries. One of the Nitro samples did not work for me, however, because of a problem with the Facebook API. The other two samples worked very well.
The Curl RTE (runtime environment) runs on Windows, Mac OS X and four versions of Linux. The Curl IDE runs on Windows and Linux. The Curl development plug-ins for Eclipse work with Eclipse 3.3 and 3.4 on Windows and Linux platforms.
The base Curl IDE and runtime that include Nitro are free, as are deployment licenses for publicly available, free Web sites that use the base capabilities. A Curl Pro/Deployment license starts at US$12,000; Curl has pricing models designed for enterprise, Internet, software-as-a-service and reseller business models.
Basically, Google Gears is a way to take Web applications offline in a browser. Curl Nitro and Adobe Air can go one step farther and dispense with the browser.
The online Gears developer documentation discusses Version 0.5, released a month ago. It includes nine samples that illustrate the use of the APIs. You can download the source to all of these samples, plus some articles, a couple of tools and an Apache mod implementing the resumable HTTP request proposal. One of the articles is a tutorial on taking Web applications offline with Gears, written by Omar Kilani of Remember The Milk . Kilani and his team implemented offline functionality for their application in "four caffeine-fueled days."
Silverlight 2 supports local data caching and isolated local storage, which is one reason to consider it for use as a desktop RIA, although like Google Gears it runs inside a browser. There's also another scenario to consider: With care, you can write a Silverlight Web application that can also be recompiled to be distributed as a WPF desktop application, and the WPF application would stand alone but be able to connect to the Internet as needed. Note that it's much easier to write a Silverlight application and recompile it for WPF than it is to take a WPF application and rewrite the parts that aren't supported by Silverlight.
Silverlight 2 runs as a runtime on Windows XP, Windows Vista and Mac OS X on Intel-based Macs. Current versions of IE, Firefox and Safari are officially supported, with "others pending customer feedback"; I have also used Silverlight 2 successfully with current versions of Google Chrome and Opera. The Microsoft development and design tools require Windows; an Eclipse plug-in for Silverlight currently requires Windows but will eventually support other operating systems. The Linux implementation of Silverlight 2 is called Moonlight 2 and is currently in an alpha state.
Silverlight has copious documentation and very good tool support. Developers typically work on Silverlight applications using Visual Studio 2008 on Windows; designers typically work on the same project using Expression Blend 2, also on Windows. Both of these tools are very good for their target audiences, but not for their secondary audiences. That is, Visual Studio 2008 is great for coding and XAML text editing and can preview XAML pages, but can't do visual XAML page design; Expression Blend 2 is great for visual XAML page design but doesn't support coding. The future Visual Studio 2010 product, now in preview, will combine both sets of capabilities.
Page BreakI am not especially impressed with the Silverlight 2 local data caching and isolated storage facilities, which are not safe from access by unmanaged code and lack an actual database. (For many occasionally connected applications, you want a local database not only to cache information read from the remote database, but also to store updates to be sent to the remote database when the connection is restored. It's easier, more efficient, more secure and more reliable to do this with a local database than with a simple caching facility.)
On the other hand, I'm very enthusiastic about Silverlight 2 as an RIA. If I wanted to build a Silverlight Web application and needed a desktop version as well, I would lean toward separately compiling the application for WPF. I would expect to have more than 90% of the code shared between the two projects if planned properly.
The Silverlight plug-ins, Silverlight SDK, .Net Framework and Visual Studio Express Editions are free; Visual Studio 2008 Standard Edition is US$299 (US$199 upgrade); Professional Edition is US$799 (US$549 upgrade). Subscriptions range from US$1,199 for Visual Studio Professional with MSDN Professional up to US$10,939 for Visual Studio Team System 2008 Team Suite with MSDN Premium. Expression Blend 2 is US$499 (US$99 upgrade).
The first question to ask when picking a desktop RIA is how the application will be used, both as a Web application and a desktop application. Then list the features you need. Are those features present in the RIAs you are considering? Are there ways to add missing features? Are you looking to enable fully or occasionally connected scenarios?
Once you've got your questions ready, you can figure out which RIA is best for your needs.
Would it be better if you had separate desktop and Web applications that shared a common code base? If so, consider a combination of WPF and Silverlight.
Will your application have CPU-bound portions? If so, consider Silverlight and Curl Nitro.
Does your application need to run locally without a browser? If so, consider Air and Curl Nitro.
Do your developers already know WPF and the .Net Framework? If so, consider Silverlight. Do they already know Flash and Flex? If so, consider Air.
Do you already have an AJAX Web application? If so, consider Air and Gears.
Finally, ask yourself if you really need a desktop RIA at all. Sometimes building a second interface for an application is a relatively small effort, if most of the work is being done by a common back end or if most of the code is common to both versions of the application. In the larger picture, sometimes the advantages to users of having separate but optimized desktop and Web user interfaces may outweigh the costs and time involved.