JavaScript: The Good Parts - Douglas Crockford

After a few years of really being rather into Haskell, and some nasty memories of Python, I've got back into an interest in dynamically-typed scripting languages. I think it started at work, with some Lua scripting in a project that's otherwise C++-based. Lua's great for that kind of thing, and it's a rather nicely designed language. The other candidate for the role was JavaScript, and it is the language of Teh Webs.

So, I bought this book. The idea of being able to write toy programs and then just being able to bung 'em on the web to be directly usable by any modern browser seemed very cool, but I knew nothing of JavaScript. This book has not taught me JavaScript. Instead, it teaches a carefully-chosen, sensible subset of JavaScript. A quite lambda-heavy one. Having read it, 'good' JavaScript appears to be writing Lua in a grottier framework. It has better regexps, but most everything else is worse.

Due to the design of the book, I'm not exactly sure which bits of the language I'm missing, but as the book's done its thing, I don't really want to know. On the other hand, I'd probably be unable to maintain someone else's JavaScript unless they stick to the 'nice' subset too. I should probably also point out that this book tells you nothing about the DOM, AJAX or other general web integration things. It really is just about JavaScript as a language.

The book is short (150 pages), and nothing like as dense as it thinks it is (unless you're not used to tonnes of anonymous functions and lexical closures). This book has made me decide I prefer BNF to railroad diagrams. It's chock-full of railroad diagrams. The best book to compare it with, given the similarity of coverage, is Programming in Lua. I'm afraid the comparison is not favourable. The Lua book is rather longer, but does cover so much more (including all the business with C bindings), and is so much more pleasant and fun to read. It does, of course, have the advantage of being written about a coherent and sensible language.

Having said all that, this book does the job, and I have no doubt that it provides a much better introduction to the language than many 'JavaScript for web monkeys' books. Now I just need to actually start writing some JavaScript programs...

Posted 2011-09-26.