Smartphone App Development With AJAX

While AJAX was off on it’s long journey from Desktop to Mobile the “Model View Controller (MVC)” legion descended on the desktop web programming world. MVC has been hidden in everything from ASP.NET, to PHP, to Ruby On Rails. The dirty little secret of MVC style programming is that it confuses the traditional “3 Tier Programming” model. The presentation layer (User Interface) and application logic gets all gummed together since the UI gets driven directly by processing that happens exclusively on the web server. On the desktop, MVC isn’t fatal since desktop computers are generally connected with fast broadband pipes all the time. On mobile, however, native apps have exposed the soft under belly of that paradigm – who wants to wait for a round-trip to the server every time the user does something on their phone?

We should all take a moment to look at mobile web sites and think what life would be like if they all felt a little bit more like native iPhone apps. Why should mobile web sites impose a worse experience where users wait while pages constantly reload. How can we make the experience feel “more native”? Well, that’s what AJAX is all about. How can we get there? As Agent Oso says “Three special steps – that’s all you need” (extra credit for knowing the reference):

Step 1: Implement UI in JavaScript and HTML5

3D transforms, spinners, multi-touch, swiping, and all kinds of great UI effects are exposed in the WebKit based browsers including iOS, Android, Symbian, WebOS, and Blackberry 6.

Step 2: Use PHP, ASP.NET, etc. only to expose data transfer web services

Don’t use PHP or other server side technologies to layout the client-side UI. Server-side technologies are best for being a conduit to data. Use them to format data in XML or JSON for consumption on the client-side of your web application.

Step 3: Think “offline”

Design you app as if it should be useful even when your user is on a plane with no internet connection. HTML5 and appMobi expose extensive caching mechanisms. Everything from images to data can be cached on the device. Every image and every piece of data that has to go over the network is a separate request to a server – it makes things unbearably slow sometimes. Cover the offline case first and the online case becomes easy. It also will follow that your users will have better experiences with your brand regardless of their network connectivity.

In software, as in fashion, if you wait long enough things come back in vogue. Today, we welcome back AJAX from its travels and we boldly predict it’s future dominance. On the desktop web, AJAX was caught in the cross-fire between browser incompatibility and muddy waters of Flash, Java, and desktop apps written in C++ or.Net. On mobile smart phones, the world is fundamentally different – with WebKit and HTML5 browser compatibility on mobile is especially good. In a framework like appMobi where a broad range of native functionality is exposed through JavaScript – the need for complex languages like C++ and Objective C is eliminated for all but the most obscure functionality. In oversimplified on mobile, AJAX finally has an opportunity to live up to it’s hype. It will help “open web” technologies supersede Flash and, in doing so, make the “native app” vs. “mobile web site” argument moot.

This entry was posted in Mobile Apps and tagged . Bookmark the permalink.