Sunday, September 11, 2011

My answer for the mobile application war

Just last week, our in-house project for the local market, PocketBank, kicked off. During the planning phase, a lot of time was spent on discussing the technologies we would be using in the project, which essentially a navigation app where we want an excellent offline mode and deploy on as many platforms as possible. The question was whether we should build a web app or a native app. The final decision was to go with native app as we failed to find a good map-kit with offline mode for web app. But thats not it, not yet. The discussion inspired further thoughts on the future of the ongoing application war.

I am not trying to make this blog another comparison between web app and native app as that kind of article/blog has been around for years and with a single Google search, you can find more than enough to read a whole night. What I am going to try is to predict the trend how people are and will be developing their applications for the current and future. The prediction at least will be carried out for my company for the coming time.

Here are some opinions of mine when making decision about the trend:

  • The fact that native app and nothing else can take full advantage of the specific features devices and platforms never changes.
  • Both leading mobile platforms iOS and Android are currently go for native app and build up a tight ecosystem around the platform (and devices), app stores and developers. A few factors of this ecosystem are awesome, like one-click payment, the powerful tools (IDE, instruments, etc.) available to native stacks. Web payment alternative such as Paypal, Google Checkout or other payment gateway is just not as convenient. I worked with XCode for a while and felt like dragged back to stone age when working on a number of HTML/CSS/JS tools). Some other factors aren't nice though, like entry cost, revenue split and that the static app stores' content oriented billing model can't fit all kind of shopping and services on the web.
  • Development cost is always a big concern. An app for iOS and Android usually calls for a developer for each and preferably more. That's double the resources a web app requires. And native app is expensive also because it requires skills and knowledge that aren't widely available. You can draw on a larger talent pool using web technology than you can with Objective-C.
  • Mobile platforms are taking steps towards a better support for web app. WebOS is a great supporter when exposing all of the API in JavaScript. And Windows 8 follows that movement, a foreseeable convergence of native and web app. But wait, do you remember the one-good-one-bad circle of Microsoft products? Windows 95 was a breaking news, Windows 98 wasn't much more than a wrapper of 95. Windows 2000 was kinda good, but WinMe wasn't. Windows XP was Microsoft's greatest OS ever and Win Vista couldn't do anything worse. Perhaps we will have to wait till Win9.
  • When a platform comes up with a new stunning feature that is not in HTML5 specifications (which takes forever to complete), it gonna take time for different browsers to implement the feature (some might never do). Despite a common belief among One Web supporter that "Regardless of who you are, what device you're using and what browser you're accessing content from, no user should be left behind.", there are a number of model browsers not as supportive as others (Android's browser, I am looking at you particularly) and eventually the next IE6 will emerge. Hopefully with the current platform/application update mechanism, thing will be less a catastrophe.
  • The native-app wrappers like PhoneGap or Titanium are getting well-known these days and they have their own use when providing HTML-based app with a (limited) set of native API. But IMHO, web app makes a better UX. Many users acknowledge traditional drawback of web app and when the experience turns out to be much better than what user expected, a little quirks won't even find its place it user's mind. But such a native app will fall right into "a piece of junk" category.
  • You hate Android's fragment? You will even hate mobile browsers' fragment  even more.
  • One Web is more a business and development decision rather than a decision to create an optimal experience for the users. The typical reason is to lower the cost and/or complexity. Compared to native apps, the web is a much wilder place. There is little or no standard about UI and UX and hence nothing to guarantee a consistent experience for users. However there are some positive points when it comes to web app UX like
    • Accessibility: generic experience for different platforms
    • No installation or update
    • Performance (don't get me wrong, I am not talking about the speed if that is the "performance" you are thinking about): no native app will ever deliver fresh content as quickly as the web 
  • Joe Hewitt's tweet: "I want desperately to be a web developer again, but if I have to wait until 2020 for browsers to do what Cocoa can do in 2010, I won't wait"

My answer for the current...
  • The current generation of cell phones aren't quite powerful enough and HTML5 isn't quite developed enough so for coming time, web app won't be able to replace non-trivial native app. 
  • Native app is the number one choice for heavy tasks and new features. And by new features, I am not limiting to what platform vendors themselves have to offer but also the involvement and contribution of third-parties, a wish for a less-close future
  • Native-app wrapper wont be come mainstream, but remains relatively helpful for the access to (limited) platform API for the current time when WebOS is suspended and Win8 is in progress 
  • Business model like that of Bizness Apps will thrive as there is a growing demand for trivial apps from companies and no platform is proven to win the market
... and for the not-too-distant future
  • Eventually "web will win" is inevitable with direct support from platform level (e.g. WebOS and Win8)
  • Lot of effort and time are required to re-establish the ecosystem native apps is living in for web app, solve the feature puzzle and develop a new HIG that is neither iOS, Android nor any specific platform but a generic experience for all users
  • Native app remains the preferable choice for what it used to be the first ranked choice (above)
  • Native-app wrapper will become far less attractive, especially if there is a way to use native code to access platform API and then expose that to JavaScript. I wont be surprise if it will be eventually extinct

Friday, September 2, 2011

jQueryMobile - More in the FIXME list

A few week ago, I had a chance to work with jQueryMobile (JQM), a framework that I have known for long and looked forward to a chance to use for some practical development. (I was using Beta 2 when I wrote this post)

Well, after the first good impression (especially when compared to its ancestor, jQTouch), I started to find out a number of thorns here and there that prevented it from being use widely in the industry.

Most of the time when I write mobile web app, I use desktop browsers to test and develop the app and only move to the device to test major changes. I can tell that the page transition of JQM on my FF 5.01 and Chrome 13.0 is pretty flaky even when compared to the old jQTouch. The reason is because JQM is using keyframe animation and depends on how supportive the browser is, some frames might be dropped and causes the transition to be a bit rough. There is plan to switch to CSS3 transition, which guarantees better performance and support from major browsers, lets see how thing will go.

Currently, JQM provides developers with single-page (pages where only one div has data-role="page") and multi-page (single HTML document with multiple div with data-role="page"). And just like jQTouch, JQM uses hash-based URL for navigation.
So if I have a single-page document and want to "slide" to the next, my url is like
single_1 -> single_1#single_2
Similarly, urls of a multi-page document look like
multiple#foo and multiple#bar
I expected the two types as two great indigents for one-page apps. But no, different from my expectation, cooperation of the two types is half-baked. If I load a multiple-page document through AJAX, all navigation within the page are broken
single -> single#multiple -> single#foo (it should have been something like single#multiple#foo)
Also, the URL of an AJAX-loaded document is lengthy and ugly as it uses the format old_url#new_url, you can find this right on JQM's demo site
NOTICE: at the moment I was writing this post, jQM team has taken steps towards above problems with the launch of pushState, which clearly makes the url far neater and hopefully in the same manner handle single/multiple-page correctly.

And the last item in my list would be the bad "back" button. JQM provides default "back" button for pages loaded via AJAX. The problem with this default button is that it disappear when you refresh the page or load it from bookmark, which is a big FAIL for me. Developer can implement the "back" button manually too, but then the transition sucks. It wasnt possible for me to manipulate the transition effect and direction (in my case, it goes slide-right, where a normal "back" should go slide-left, but perhaps that's just me).

I would complain about the behavior of the button as well. JQM's "back" button functions as literal history of pages. This approach is similar to iOS' and Android's back button and works great for native apps. But web app is different. The user can interfere the URL, and when that comes, a history of pages leads to all kind of funny redirect as the "back" might structurally mess up the app workflow. I would love to see the button acts like a breadcrumb trail and therefore respect the app structure.

Just my two cents. I remain a big fan of jQueryMobile and its team, eagerly looking forward to the 1.0