OpenLaszlo and the iPhone

From the viewpoint of a user interface enthusiast, Apple's iPhone is a deeply fascinating product. Whatever its flaws as a mobile phone, the UI design represents the state of the art in what we at Laszlo call the "cinematic user experience" -- meaning an interactive experience in which animation, motion, and visual continuity are used to enhance usability. The sheer amount of detail work that has gone into every aspect of the UI, and the way in which the GUI has been put at the center of the experience, mark this product as unique in its category.

If you're an OpenLaszlo developer looking at the iPhone UI, you'll be thinking about how its various transitions and interactive elements would be represented in LZX -- you can almost see constraints, animators, and states behind its effects. In fact, the iPhone UI is exactly the kind of expressive, cinematic experience that LZX was made to enable -- and I bet it would have been radically simplified if implemented in LZX rather than native code.

Which raises the issue: what about using OpenLaszlo to develop for the iPhone? Well, in some ways this is a very natural fit. Besides enabling the style of UI that the iPhone has embraced, OpenLaszlo 4 works very, very well with the Safari 3 (desktop) browser, and does not require Flash or Java to deliver rich applications -- which is great, since the iPhone has neither Flash nor Java.

LzPix on the iPhone

It is positively amazing that some OpenLaszlo applications work correctly without alteration on the iPhone. I don't think any other RIA platform can claim this level of functionality; certainly none that depend on Flash or Java. (Don't expect a Flex app to work on this device!) The momentum behind "mobile Ajax" is real -- not only with Apple, but also with Nokia -- and validates our choice of DHTML as a target runtime. Flash-free RIAs definitely have a bright future, especially on mobile.

But, this is very much an evolving story, and as things stand today, the iPhone browser introduces unique challenges that are not present in the desktop version of Safari. These issues are not OpenLaszlo-specific, and to varying degrees are shared with other JavaScript frameworks and RIA platforms. Although the iPhone browser is a "real" browser compared to previous generation mobile browsers, is does deviate from desktop browsers in some respects.

Last week, there were a series of announcements from companies working in the Ajax/RIA area that were premature -- they didn't have iPhones in hand, and just assumed that the iPhone environment and the Safari (desktop) environment were the same. ("Hey, the iPhone supports Ajax. Our tool supports Ajax. So we're done. Let's issue a press release!"). Nice try, but the realities are a bit different, at least for the time being:

  • Poor JavaScript performace. While we have not yet done any formal profiling of applications running on the device, it appears that JavaScript execution speed, as compared to HTML rendering proper, is disproportionately slow. With its 667 MHz CPU, rendering speed is quite good, as you would expect on a machine of this speed. JavaScript execution speed, by contrast, feels *much* slower. The result is that OpenLaszlo applications (however simple) take unexpectedly long to start once loaded on the iPhone. We're hoping that this is temporary and will be addressed in a future update; but perhaps there is a systematic reason for this that will prevent near-term improvement.
  • Limited JavaScript memory allocation. There is a 10MB limit on JavaScript object allocation, which sounds like a lot until you consider that OpenLaszlo applications are entirely JavaScript-dependent, and make little use of statically rendered HTML. To put this another way: even an object as simple as a button in OpenLaszlo requires a significant number of JS objects to be allocated, initialized and positioned via script -- which is very different from a typical Web site. The net result is that only relatively simple OpenLaszlo applications will launch on the iPhone for the time being.
  • Input field problems. As users have been reporting, the iPhone's Safari browser does not work correctly with certain text input fields on certain websites. This is apparently the result of the unconventional event sequences that the browser sends to the fields. As things stand, text fields in OpenLaszlo applications do not take any input. This may be fixable in OpenLaszlo, but a systematic fix in the iPhone browser would be preferable.
  • Native UI controls vs. synthesized UI controls. OpenLaszlo displays UI controls (components) the same way everywhere, regardless of runtime environment or host OS. This philosophy has advantages, in that a UI component created in LZX will act and work the same everywhere, and is portable across runtimes. It also has limitations: where Apple, for example, does special things with menus on web pages (which are quite nice), an OpenLaszlo application running on the iPhone will not take advantage of this behavior, since the browser does not see an OpenLaszlo menu as a menu. This is not so much an OpenLaszlo bug as a design approach that works against OpenLaszlo in this particular case.
  • Finally, the trickiest problem: UI paradigm incompatibilities. The iPhone browser has a handful of UI features that have the effect of making certain UI gestures impossible to capture within a browser-based application. The browser "steals" drag and double-tap gestures, so that a browser-based application running on the iPhone cannot rely on either drag-and-drop or on double-click. These gestures (and others, like "pinch") would have to be passed through to the browser in order for the developer-created app to see them; but this would come at the expense of Apple's ability to guarantee the integrity of the experience.
  • Obviously these are the early days of iPhone, and we should expect changes. As things stand, iPhone is not a supported target for OpenLaszlo; while most functions do work correctly, there are significant limitations, and some of those limitations are limitations of Apple's software (at least in its first revision), and others are more fundamental to iPhone UI environment, and will require iPhone-specific interaction design -- i.e., drop the drag-and-drop.

    That being said, a group from Laszlo is attending the iPhoneDevCamp this weekend (hey, we're even a sponsor!), and we're hoping to give OL a solid workout in the iPhone/Safari environment. If we're lucky, something cool will come out of it, and perhaps a better sense of where things work and where they don't. But it seems like a safe bet that no matter what happens this weekend, we (along with other Ajax development platforms) will be very dependent on Apple to upgrade its JavaScript performance before the iPhone becomes the truly awesome OpenLaszlo environment that it deserves to be.

6 Responses to “OpenLaszlo and the iPhone”

  1. Raju Bitter » iPhoneDevCamp with OpenLaszlo Says:

    [...] Many people have been asking us if OpenLaszlo DHTML/Ajax apps will run on the iPhone. Generally yes, but with limitations. You can read the full story on OpenLaszlo and the iPhone in the OpenLaszlo.org blog (excellent post by David Temkin). [...]

  2. Raju Bitter » OpenLaszlo und das iPhone Says:

    [...] Dies ist eine Übersetzung des Blogposts von David Temkin im OpenLaszlo.org Blog zu OpenLaszlo auf dem iPhone [...]

  3. OpenLaszlo Community Germany · OpenLaszlo und das iPhone Says:

    [...] Für alle iPhone begeisterten oder Leute mit Interesse an mobile Ajax und OpenLaszlo: David Temkin, der CTO von Laszlo, hat einen interessanten Blogbeitrag zum iPhone und OpenLaszlo geschrieben, mit technischen Details und interessanten Gedanken. Das Original (Englisch) findet ihr hier, eine deutsche Übersetzung in meinem Blog. Ajax iPhone MobileAjax OpenLaszlo [...]

  4. FredCavazza.net » Et on reparle de l’iPhone Says:

    [...] OpenLaszlo and the iPhone (comme quoi ça urge d’implémenter Flash !) ; [...]

  5. Raju Bitter » Ben and Bret at iPhoneDevCamp for the OpenLaszlo team Says:

    [...] Want to learn more on OpenLaszlo and how you can use it to create a cinematic user experience for the iPhone? Then don’t miss David Temkin’s blog post on “OpenLaszlo and the iPhone”. Tags: AJAX, Animation, apple, Fascinating, iPhone, iphonedevcamp, Laszlo Systems, Laszlorific, LZX, mobile Ajax, newsmatch, OpenLaszlo, Programming [...]

  6. jgrandy Says:

    There’s a page on the OpenLaszlo wiki for discussing our experiences with iPhone:

    http://wiki.openlaszlo.org/IPhone_Experiences