On Javascript

A few days ago, James Higgs gave a talk at the Front-end conference in London – I’ll get back to the actual topic of that talk in a further post but I wanted to spend some time on one of the opening statements:

I really like Javascript, actually. Not trolling. […]. The reason I really like it is that it is by far the easiest way to get code running on somebody’s machine today.

This is simply impossible to disagree with. Javascript is the most accessible and widely-distributed VM for both developers and users today. There is no overhead in installing an app, you just load a website and it might be a Jekyll blog or it might be a full-featured 3D game. I don’t believe he was the one who coined the term, but Eric Schmidt was heard several times stating that Javascript is the assembly of the Web.

It’s been around for 20 years now – both application developers and browsers vendors have a lot invested in it. In other words, you can always hope that something better is going to show up, but it’s going to be a while before something else becomes as widely adopted.

It is quirky and imperfect, lacks ‘elegance’ as well as some concepts that are core to more respectable programming languages. But most importantly: it’s there and it’s waiting for developers to use it well – which is something that has become amazingly easier with the tooling and libraries we have handy. While it’s truly regrettable that vendors have introduced incompatibilities and proprietary extensions to the web platform, active work is being done on resolving those and moving forward at once.

JQuery has done an astounding job ironing out the kinks across browsers – it sucks that you have to include a 3rd party library just to get to work but it can’t be a deal-breaker. The same kind of fragmentation and inconsistencies routinely happens on the native side, and we just deal with it.

As someone who worked in Java for several years, CoffeeScript has provided me with a warm and fuzzy environment to work in. I know the generated code is subpar but it’s good enough and from where I stand, the tradeoff is well worth it: CoffeeScript doesn’t limit my ability to write proper Javascript but it helps me get to my goal quicker. The Chrome Web Inspector is an outstanding tool for whoever dabbles in web development.

And it’s not going anywhere – there’s simply no alternative at this point. And I realize data is not the plural of anecdote, but Google has given us enough anecdotes to write a book:

  • Blink is steadily adding features to the platform, with the stated goal of bringing the web on par with native platforms. ES6 is on the horizon.
  • Polymer is the closest thing there is to programming an Android app for the web.
  • In September, the Chrome team has shipped an Android VM running in the browser.
  • Material design is an attempt at unifying the user experience across Google devices and applications. Inbox is a good example of that. And why would a developer targeting the web need to have a battery icon?

It’s not far fetched to assert that Google is working hard to blend in the two platforms over which they have the most control: Android and the web. Sundar Pichai is, after all, heading both groups. With this in mind, it’s possible that we’ll soon have a situation where Android apps run seamlessly inside of Chrome, but where Javascript is a first-class binding on Android. I’m looking forward to Google I/O next year.

So, the reason I like Javascript isn’t because it’s a great language. It still trips me on more occasions than I like to admit. But I love its potential – the web platform is gaining in strength with every release of Chrome and Firefox. That’s like introducing new APIs in an operating system every six weeks. And all the user has to do is reload the page.