Issue #36: Innovation,  Library

Douglas Crockford

O’Reilly published in 2020 the seventh edition of one of the biggest bestseller programming books of the past 25 years, Flanagan’s “JavaScript: The Definitive Guide”. At 700 pages and weighing 1.2 kg, it is a book that easily stands out in any good programmer’s library. Many developers have used such information to joke about the fact that the good parts of JavaScript, as catalogued by Crockford in his eponymous 2008 book, is merely 180 pages long, and weights only 290 grams; that is, only 25% of JavaScript is actually any good.

That comparison is misleading, to say the least, particularly because Crockford’s book also includes a colophon, a dedication, a preface, lots of syntax diagrams, and two appendices called “Bad Parts” and “Awful Parts”. All in all, the good parts are just 140 pages, give or take.

Before the book, Crockford was already a celebrity for many of us dealing with JavaScript in a daily basis. This author came across his humble web page around 2002, still available at the time of this writing, where he claimed that JavaScript was “The World’s Most Misunderstood Programming Language”. The revelation was not small, and in hindsight, was a major event for the software industry.

The issues with JavaScript, of course, start with the name. The language that Brendan Eich baptised LiveScript was renamed to JavaScript during the dotcom craze of the 1990s, because marketing and NASDAQ and Java and IPOs and Sun and Netscape and whatnot. These days LiveScript is an actual different thing, but still related to JavaScript, just to make things more confusing for everyone. But the industry remained confused about the subject of Java vs. JavaScript for decades. Jeremy Keith summarized the situation in one phrase: “Java is to JavaScript as ham is to hamster.”

Then there were paradigm issues; Java was the apotheosis of object orientation. JavaScript… has a new keyword, but one which does not work exactly the way a Java developer would expect. And it has a weird inheritance model. And of course object orientation in the 1990s was all about inheritance and nothing about composition, because few had read Barbara Liskov’s paper yet. So if JavaScript’s inheritance was not in the flavor of Java’s or C++’s, clearly it was inferior. To illustrate the confusion, Crockford even explained how to encapsulate private fields with JavaScript in his website.

Finally, there were quirks. There were many. JavaScript could use semicolons, or not; there were String and string, and nobody quite understood the relationship between both; there was == and === and nobody quite understood the difference between both. And the list could go on and on and on.

(These were the subjects developers argued about in Slashdot or Evolt back in those days, long before Reddit or A List Apart were a thing.)

Crockford’s website (and later, book) was arguably one of the igniters of the renaissance of JavaScript. In the wake of the dotcom bubble crash, as web developers were struggling to find a job, Crockford realized that what we needed was to calm down for a minute, have a cup of tea, and realize that JavaScript was different. Just that; not better, not worse, just different, and that no, it did not suck. We just needed to take a breath, and stop screaming the words “startup” and “IPO” to every venture capitalist walking in the street.

If this was not enough for his résumé, let us not forget that Crockford also introduced JSON and JSLint to the world.

But we can go even further, without exaggeration or hyperbole: in retrospective, the biggest contribution of Crockford was to finally make functional programming mainstream. It was this book, together with the rise of Ruby on Rails, what would make millions of developers all over the world, including the author of these lines, understand what a closure was for the first time. And since, according to Herb Sutter at least, the free lunch was over, the time was ripe for functional programming to rise.

Cover photo by the author.

Donate using Liberapay

Adrian Kosmaczewski is a published writer, a trainer, and a conference speaker, with more than 25 years of experience in the software industry. He holds a Master's degree in Information Technology from the University of Liverpool.