A few months ago Mark Zuckerberg made headlines all over the place when he said HTML5 wasn't there yet and announced Facebook would be going all native with their mobile applications. As someone who believes whole heartedly in the ability of HTML5 this never sat well with me. As I had time I did some research into what areas Facebook encountered problems. I mean their iPad, iPhone and Windows Phone apps (the ones I am most familiar) were pretty simple, so I could not get my head wrapped around why their application was not 'good' or how they could have messed up the implementation in HTML5.
According to information released by one of their engineers, Tobie Langel, it was about poor experiences with their infinite news feed as well as mobile browser tooling. As I read his comments I also could not help but hear him stating Android is the big problem. I agree with the Android sentiment, the new IE6 problem. But as for the animations, memory and other 'black box' issues I never really felt like they should be an issue. Personally I have dealt with all those issues, many times over and I know they can be frustrating, but they don't have to be limiting.
Last week the Sencha team did a great job proving my point, HTML5 and CSS3 are not the real issue. The real issue Facebook has is poor application architecture. In fact they made a good case for why most web sites are just not acceptable in the modern world, they are written to be good a decade ago, when slow and laggy was acceptable. Today standards have been raised, thanks in large part to the rise of native iOS and Metro UI apps (yes I did not include Android, they lower the bar in my opinion).
For the record Tobie Langel, the Facebook Engineer made these points about mobile HTML5:
- Tooling/Developer APIs
- Scrolling Performance
I agree, accessing information about what is happening on the device is tough. Android probably has the best experience for this, but it takes some effort. The latest version of mobile Safari also has some rich debugging capabilities, if you own a MAC desktop. Generally I tend to work out the application parts on the desktop, knowing mobile constrains the experience more. So I tend to spend a large amount of time optimizing the client experience on the desktop then deploy to test on a battery of devices. It takes more time than we are traditionally used to allotting and there is no F12 support. I would love better tooling, but I can work around it most of the time, it takes some patience and imagination.
Good scrolling can be a booger. I have been working on this and think I will wait to provide a more detailed study on ways to achieve quality mobile scrolling. The GPU is a black box, and honestly I feel like it is on the desktop too. I guess I don't worry about it that much. I know I can flip some Chrome settings to visualize how the GPU is being applied, but I rarely do. I know CSS3 transforms do a pretty darn good job.
The Other section touched on poor implementation of touch on Android, reiterated his beef with poor animations and talked about caching. I have a pretty darn good strategy around caching in modern web apps thanks to localStorage and IndexDB. I also agree with him about applicationCache being busted, which is why I developed my caching strategy. If you have seen me present over the past you have seen me demonstrate this in action.
As far as touch on Android goes, see my previous comments. He is correct, Android is a poor user experience, no doubt. And please don't tell me you have a Galaxy SIII and things are great. You are an extreme minority as most Android uses are using version 2.X, and the number 2.X activations only increases everyday. And I have Jelly Bean installed and I am not impressed with it either.
Which leads me to the main point of this post, the problem with Facebook's HTML5 strategy is their overall application architecture. I love what Sencha did:
"We connected an iPhone to a web debugging proxy, and started to look at the HTTP traffic the application pushed over the network. Our biggest shock: much of the application was still raw HTML pages."
Here is an example snippet from one of the requests I saw while writing this article:
The Facebook infinite scroller does create another problem, one Langel referred to in his post, eventually you hit memory pressures and the browser simply crashes. Even on the desktop you need to care about his because a large DOM kills performance. So for an infinite scroller you want to remove unneeded DOM elements, in the case of the infinite scroller this would be elements that are far enough off the screen to not be accessible with a few finger flicks. The Windows 8 ListView takes this into account and utilizes a solid virtualization management system.
Covering what I consider good modern web application architecture is much more involved than what I can cover in one post or even a series of posts. I encourage you to read the Sencha Fastbook post because it details many good practices with a real example that implements them. I applaud them for doing this because I simply don't have the time, but knew someone would do something to disprove the Facebook claims.
Shame on Facebook for poorly architecting their application and blaming it on HTML5. They could have done a much better job building their application. Sure they would have still determined Android is a problem, but they could have done a good HTML5 application regardless. There are still some issues I have with the way HTML5 is or is not implemented at this point and I have written about that. I blame the browser vendors for this, they need to implement the full spectrum of device APIs and be bold about it. As developers and architects we have to do a much better job architecting our modern web application experiences and let go of the techniques we used in the past, they are no good anymore.