Writing by Peter Hilton

AdorableJS

why JavaScript frameworks live short but happy lives - 12 February 2015 #JavaScript #naming

A friend of mine, who isn’t a programmer, recently wrote to me with a question:

What does .JS mean on the end of a tool like Angular or Backbone?

At first glance, this is just an easy question with an easy answer: ‘js’ (often lower-case) is an abbreviation for JavaScript, and it is common for frameworks written in JavaScript to have ‘.js’ at the end of their names. There you go!

However, if you start thinking about where the naming convention comes from, and why it’s popular, then you might suspect that there’s a story here.

File name-based framework naming

The obvious explanation for the -.js suffix is that the frameworks are taking their names from their source files:

JavaScript files - JavaScript frameworks

AngularJS then, simply takes its name from the file name angular.js. So what’s the big deal? The big deal isn’t that the framework name comes from the file name. The big deal is that there’s only one file. If it were some other programming language, there’d be thousands.

It’s significant that you can make a JavaScript framework in a single file. JavaScript is easy like that sometimes: you’ve written some kind of reusable framework and the default packaging is… no packaging at all. There are more complex approaches, but they’re not required.

My first conclusion, then, is that JavaScript turns out to be remarkably good at enabling reusability with a shallow learning curve. Either that, or standards for what you can call a ‘JavaScript framework’ are extremely low.

JavaScript framework proliferation

The problem with it being so easy to create a little framework is neatly summed up by James Ward, in this ‘sign at the W3C headquarters’:

0 days since last new JavaScript framework

There are new JavaScript frameworks on a daily basis. Why are their so many? Pioneering JavaScript programmer Flannery O’Connor offers one explanation:

Everywhere I go, I’m asked if I think the universities stifle JavaScript developers by making them learn other languages. My opinion is that they don’t stifle enough of them. There’s many a JavaScript framework that could have been prevented by a good teacher.

An alternative point of view can be found in mid-twentieth century Chinese communism. In Peking, in February 1957, Chairman Mao Zedong was far ahead of his time when the JavaScript community was invited to criticise prevailing thinking in web front-end architecture:

Letting a hundred flowers blossom and a hundred schools of thought contend is the policy for promoting progress in the arts and the sciences and a flourishing socialist culture in our land.

Fast-forward to the present day: there are many shortages in the world, but JavaScript frameworks isn’t one of them. My second conclusion is therefore that it is not only easy for JavaScript developers to create frameworks: it is so compelling that it threatens our fragile ecosystems. Perhaps national governments should pursue Non-Proliferation Treaties with the JavaScript community.

Hollywood naming disambiguation

The shocking number of new JavaScript frameworks leads to another insight into the -JS suffix. As the number of JavaScript frameworks approaches the number of words in the dictionary, the suffix is the only way to keep all of the new names unique.

That JavaScript frameworks are so numerous has a parallel in Hollywood. There are so many new cinema releases that the only way to reliably find an available domain name for the marketing web site is by adding the -movie.com suffix to the name. As to whether there is a link between the quality of the output from Hollywood and the JavaScript community, the question requires further research.

Short but happy lives

Finally, we come to the natural consequence of there being more JavaScript frameworks than there are JavaScript developers, which is best captured by the inimitable @iamdevloper:

‏@iamdevloper: I think I've had milk last longer than some JavaScript frameworks.

If Java EE frameworks are dinosaurs, then Javascript frameworks are mayflies. Strangely, some people think this is a bad thing, and somehow fail to grasp how wonderful it is that so many little JavaScript frameworks see the light of day. A more reasonable reaction: aw bless, they’re so adorable.

comments powered by Disqus