HTML5 and JavaScript: Worse is Better?

HTML5, by which I mean the combination of HTML5, JavaScript and CSS3, is in the place where Java originally wanted to be. It is truly cross platform and if not quite “write-once-run-anywhere”, then it is much closer to that ideal than anything else has ever been. If we want to target Macs, PCs, ChromeBooks, tablets, mobile devices, then about the only thing they have in common is that they all run HTML5.

We are now at a stage where HTML5 is wielded as a serious application development platform. Consider the fact that Spotify builds its apps using HTML5, CSS and JavaScript, and that the Spotify product is essentially just another Spotify app; if you go to an artist page, it’s the same on as on the desktop client.

To many, the burgeoning ubiquity of HTML5/JavaScript is a cause for celebration. On the client, with help from Adobe Air, or the framework formerly known as Metro, it can perform some intimate acts with the operating system that supports it. With Ext Js, or one of the many other JavaScript libraries, it can behave more like an application and less like a traditional browser, in order to make its use more palatable. Sure, there is plenty to criticize in JavaScript, but it can be made to work well and gets the job done. On the server-side, the emergence of node.js makes it easy to create event-driven asynchronous services, for applications and websites. It means that they can create HTML5-based applications using just one language.

Even five years ago, people would have deemed Spotify mad, building desktop apps in HTML and supporting cast, and many find little to celebrate in the emergence of an application development “platform” based on languages originally designed for presenting textual documents. They deride JavaScript. They point out that node.js uses a non-blocking style of writing code, without anything in the language that helps escape “callback hell“.

Ultimately, it’s true that the result is a compromised, “glued together” platform that by sheer dint of its ubiquity will triumph over “properly engineered” solutions, but that’s nothing new. It’s the superior survival characteristics of “worse-is-better” over the “right thing”. A solution that’s good enough, easy to implement and easy to use will usually beat the “better” solution. UNIX isn’t perfect, but Plan 9 wasn’t superior enough to displace it. C is straightforward to implement, so it’s the most common systems language. Likewise, HTML5 is on every device, and lets our desktop client and web application share the same user interface. So let’s accept its flaws and work on refining the solution. What do you think?

I’d like to acknowledge useful chats with Mike Williamson and Andrew Hunter, in writing this piece.