August 28, 2012

I remember sitting through a session in the Mobile Asia Congress last year, where a Facebook engineer proudly shared how they had managed to handle their cross platform development strategy in a "write once, run everywhere" manner. I remember him explaining how they had developed a HTML/native hybrid (mostly HTML) solution approach where they streamed the majority of the app from the server as HTML, then used native code where they felt like they had to. More or less, the same presentation was apparently given by other Facebook representatives, for example this one.


Here's a highlight of the speech given (from the above link):

".. betting on the browser is just kind of something that we do at Facebook. It is what we are good at and it is our ultimate opportunity to move fast and we are betting hard on the Web because that is what got us here (f8) today. So, we basically want to put the browser inside the Facebook for iPhone app."

Coming from Facebook, this never surprised me. Their DNA and all expertise is in the web, in HTML, JavaScript, CSS and the likes. For them to feel like they would want to use all that on mobile as well did not come off as a surprise at all. And from the sound of it, they have invested a lot of development work into this strategy.

So what is it, then, that I read on the news this week: Facebook Rebuilds Its iOS App, Siding With Apple Against Google. A new iOS app was indeed released by Facebook, but this time they have ditched all those things that they talked about. There is no HTML, JavaScript, or CSS here. They started a new Objective-C application from scratch, and wrote the entire app in native code. Forget HTML, forget cross platform and forget the "write once, write everywhere” strategy.

Having heard the proud and satisfied tone of their presentations before, and having read about it even further, receiving this news WAS something that came as a surprise.

Specifically, what I find remarkable here is that Facebook, a high profile proponent of web technologies and HTML5, in such a concrete and practical manner, accepts and admits the shortcomings of HTML based technologies (and the insufficiency of such technologies for their own practical purposes). The explanation of Jonathan Dann, a Facebook developer, starts by stating the practical outcome of the change from HTML to native:

"..a new version of Facebook for iOS that's faster, more reliable, and easier to use than ever before."

Other notable statements from the same article (emphasis mine):

"..HTML5 has historically allowed us to keep the Facebook mobile experience current and widely available, and has been instrumental in getting us to where we are today.."

Followed by:

".. we realized that when it comes to platforms like iOS, people expect a fast, reliable experience and our iOS app was falling short."

And:

"One of the biggest advantages we've gained from building on native iOS has been the ability to make the app fast."

As the same article was commented on in ReadWriteWeb, they also noted that:

"Facebook achieved three main benefits by embracing native code for its iOS app. Foremost, the app now opens faster, without the lag that many users complained about. Second, scrolling is smoother. Third, photos are uploaded instantly. "

Followed by:

"Facebook is now using Objective-C for its iOS app, which executes much faster than HTML5"

And also:

"A natural consequence of moving from HTML5 to Objective-C is better scrolling."

Note here the natural and obvious distinction between HTML5 and native. HTML5 is not native, and it shows in performance, despite the attempts of some platforms and tools to "disguise” HTML5/JavaScript applications in native installers and calling them "native”. It is simply not native, and they do not perform as such (as Facebook also has apparently learned through experience). Wrapping a browser in a native app is easy to do, but it does not provide the optimal user experience that modern users are expecting.

In effect, just by looking at Facebook's experience, it would seem appropriate to conclude that HTML(5) based technologies are (at least for the kind of application they are targeting) simply too slow and otherwise lacking to provide a compelling user experience. And coming from Facebook, this should have weight, as they are in all effects, a web development company that knows how to write their JavaScript code. I would therefore like to encourage everyone to likewise look at Facebook's experience, learn from it and ask oneself if an HTML5/JavaScript based approach for cross platform development is indeed a sensible one.

Because writing JavaScript and HTML5 is not the only way to develop cross platform software. And clearly not the best.


Share this article: