Monday, January 12, 2009

I've been seeing a number of folks describing applications for the just-announced Palm webOS as "web apps." It's understandable given the name and some of the technologies mentioned at CES, but it's quite misleading. I posted an explanation of this on PalmInfocenter and figured I would post it here as well (with a few edits) since what Palm has really done is create an interesting new fusion between web and locally installed applications.

First of all, a web application runs in a browser, which is a piece of software that's optimized first and foremost for making requests to a server on the Internet and rendering the responses as a web page. Browsers have gradually been twisted or tortured with plugins to playback media, use cookies as local databases, and integrate with other apps on the machine, but to operate reliably and safely on the Internet they're necessarily somewhat crippled in using features of the system or hardware. Just because Palm said that webOS apps can be written with HTML, CSS and JavaScript doesn't mean they run in a browser or have the limitations of a web browser. Those are technologies for rendering a GUI that can--and have been--used outside the confines of the browser, and Palm is doing just that.

Secondly, people should understand that HTML 5 goes well beyond what we're accustomed to thinking of as HTML. It includes APIs for immediate-mode 2D drawing, video playback, offline databases, drag-and-drop--pretty cutting edge stuff. Palm is certainly the first company to release a mobile product based on HTML 5, and even modern desktop browsers only implement parts of the spec, often through optionally installed plugins like Google Gears.

As for JavaScript, it's a general programming language that is separate from the HTML document object model that it's most commonly associated with. Palm has already stated that they have extended that model to enable access to local databases on the phone and handling of notifications of system events, and there's no reason they couldn't expose much of the system API that way if they chose to. Sure, you're not going to be able to write hardware drivers in JavaScript but while some developers have good reasons for wanting to do such things a little sandboxing can a good thing on a device connected to the wild, wild Internet. A developer who partnered with Palm told the press at CES that "everything he did before in Visual Studio he could do in Javascript on the Pre." If he was much of a Visual Studio developer at all that means there's a lot more than the HTML DOM being scripted there.

Next, there's the complaint that JavaScript and HTML are interpreted and therefore slow. But remember, webOS applications aren't running in a browser, so there's nothing that says any of this need be interpreted. Palm knows all about compiling HTML applications into native code: they developed tools and APIs for doing this on the Palm VII back in 1999 and presumably own patents on it. They called these "web clipping" applications, and they displayed in the launcher and ran as first-class native applications on Palm devices, not as interpreted scripts in an HTML browser.

Now JavaScript may not be a lot of fun to code and debug, compared to a statically compiled language like Java or even C/C++. But let's remember that we don't have an SDK yet. Until we do we have no idea if JavaScript is the only API or if there are other ways to access more of the system APIs. Obviously there are other ways to access system APIs, which developers will discover on their own if Palm doesn't document them, but for now it's too early to say. I have a suspicion that a Java runtime is lurking in there somewhere and Palm didn't want to mention it yet for fear of comments about Palm being "late to the mobile Java party." J2ME, Danger, RIM, Android, JavaFX, Sprint Titan... the advance of mobile Java may be exciting for mobile Java developers but to everyone else a new Java SDK sounds warmed over, and Palm's had enough of that kind of talk.

If you watched any of the announcement you know that webOS is also intended for delivering a cutting edge web app experience, but that has to do with the browser they developed. It should also be clear that applications originally written for the web using JS/HTML/CSS (like GMail, BaseCamp, Facebook, etc.) should be easy to port to webOS and be enhanced to run in offline mode, due to webOS's HTML 5 support for offline databases.

All this starts to blur the distinction between "web apps" and "local apps," and that's where I think we're going with the mobile web. My friend Enrique Ortiz seems to agree. Nice to see good old Palm pushing out the frontier once again.

Comments

How do you write hardware-intensive games in javascript? Those usually require to be written in low-level languages to provide a good enough user experience...

Posted by feranick at Wednesday, January 28, 2009 18:07:37

There are a lot of ways to answer that these days. First, there's been some pretty impressive work done on JS runtime execution (nod to Google's open source V8 JS engine). Secondly, don't assume that JavaScript necessarily has to be interpreted code, just because that's how it's usually used in the browser. It could very well be that the Mojo SDK compiles your scripts at build time to bytecode or even machine code. Finally, while Palm seems initially focused on webOS being more of a mobile RIA platform than a gaming platform, if there are performance limitations that make the gaming experience unsatisfactory there's nothing to say they couldn't provide hooks for safely invoking chunks of native code. Getting back to the subject of the post, the fact that webOS apps are not running in a browser makes this kind of model a lot easier to support.

Posted by cervezas at Tuesday, February 03, 2009 15:04:29

Add Comment

Comments must be approved before being published. Thank you!