Thoughts on the Web Platform

3 minute read

My feelings towards the Web platform are of disgust and delight at the same time.

The Web is the only way to reach almost everyone in the world, regardless of the operating system they use. If they have a smartphone and a data plan they can get my application. I only have to develop it once, swear for a couple of months on all those Android devices still shipping with a stupidly broken WebKit implementation and then I’m done.

On paper, the Web platform is a marvelous thing.

It comes with a price though: non-native UI, near zero integration with the operating system, abysmal performance. The fact that everything is built on 25 years of technology meant to render text documents is the proverbial icing on the cake.

Yet, armed with our rocks and hammers we keep trying to bang out full blown applications built on few good core ideas drowned in a sea of crummy ones.

The simple fact that every six months we discover a new way to cobble HTML, CSS and JavaScript together to build “applications” is a clear sign that we are trying to coerce browsers to do something they were never designed to do.

The end result is that, while we are all carrying supercomputers in our pockets, most software doesn’t run any better than ten years ago. Instead, most web applications feel slow and bloated and you have to go to great lengths to do reverse that perception. Even big names realized that native applications are still the only way to deliver a great experience, especially on low end devices that don’t have all the resources to cope with the inherent inefficiency of current browsers.

It’s time to stop and rethink how we can improve the web platform for applications without making it worse for everything else.

I have this recurrent thought that maybe we could stop adding new features to HTML5 and instead create a new “rendering mode”, with an entirely different code path triggered by the presence of a special doctype. This could be implemented with a leaner rendering engine that could re-use some essential pieces from the legacy one, discarding all the rest to provide an efficient runtime. Here’s my wish list:

  • I want XHTML back. HTML5 is full of corner cases and while XML is by no means easy to parse it is at least well understood and widely supported and a more predictable markup language.
  • Be strict with errors, failing at the first one instead of chugging along leaving my application in an unusable, broken, state. If the underlying technologies are well documented and standardized I see no reason to accept malformed input.
  • Get rid of the CSS box model. Get rid of flexbox. I want a real layout engine and there’s plenty of native frameworks to get inspiration from. AutoLayout from iOS? QML’s anchors system? Qt’s or Android’s box layouts with springs? I will take anything as long as I, the developer, can extend it with custom logic, just as I can do in any of the aformentioned toolkits.
  • Get rid of JavaScript. The language might be good at its core but is rotten all around, to the point we had to write books to discourage use of its broken parts. Millions of dollars were spent trying to optimize it and the results are not so great. Thankfully, after the false starts represented by asm.js and PNaCl we might be finally reaching consensus with WebAssembly.

I know that asking to break compatibility with the current Web is too much to ask, but the unwillingness to create a new “major revision” of the Web platform brought us here, playing catch-up with features native platforms had ten years ago.