12 April 2013

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 play.spotify.com 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.

Keep up to date with Simple-Talk

For more articles like this delivered fortnightly, sign up to the Simple-Talk newsletter

This post has been viewed 4275 times – thanks for reading.

  • Rate
    [Total: 0    Average: 0/5]
  • Share

Tony Davis is an Editor with Red Gate Software, based in Cambridge (UK), specializing in databases, and especially SQL Server. He edits articles and writes editorials for both the Simple-talk.com and SQLServerCentral.com websites and newsletters, with a combined audience of over 1.5 million subscribers. You can sample his short-form writing at either his Simple-Talk.com blog or his SQLServerCentral.com author page.

As the editor behind most of the SQL Server books published by Red Gate, he spends much of his time helping others express what they know about SQL Server. He is also the lead author of the book, SQL Server Transaction Log Management.

In his spare time, he enjoys running, football, contemporary fiction and real ale.

View all articles by Tony Davis