Peter-Paul Koch, ppk on JavaScript — June 27, 2010

Peter-Paul Koch, ppk on JavaScript

Cover of 'ppk on JavaScript': the letters 'ppk' spelled out hacker-like, with ']{' supposed to form a 'k' and so forth.

This is a book for beginning JavaScript developers. If they come to this book with any pre-existing software-development experience, and they have any choice in the matter, the most sensible response will be to run away from the field as fast as possible.

There’s no *elegance* in this book. It is a collection of ways to hack around browser defects. This is expected, given that its author runs the famous QuirksMode website, documenting in glorious detail all the ways that browsers vary in their support for web standards. You’ll find, for instance, that Internet Explorer calls the target of an event its `srcElement`, while the standard calls it its `target`. So then you’re required to write a little shim like ppk’s `doSomething()` method. Or you’ll find that the XMLHTTPRequest object behaves differently under different browsers, requiring another abstraction like ppk’s `createXMLHTTPObject()`.

None of this is actually interesting. At best, when you’re done using every one of these abstractions, you will have overcome some silly impediments to doing what you actually want to do. What is interesting about software development is *actually solving problems*. When a language — or, in this case, an ill-specified language with competing frameworks — gets in the way of getting the task done, it forces you to gnash your teeth just to accomplish basic chores, not to speak of the challenge that you entered the profession to solve. Syntax hurdles are not interesting; actual substantive problems are.

This sort of problem is why libraries like jQuery exist. Instead of dealing with every browser’s strange implementation of XMLHTTPRequest, you deal with a normalized jQuery object that looks like `$(someObject)`. That `$(…)` business is where all the `target`-versus-`srcObject`, `ActiveXObject`-versus-`XMLHTTPRequest` nastiness gets hidden.

Indeed, throughout [book: ppk on JavaScript], all I could think was that much of what Koch was writing should be hidden behind frameworks like jQuery. (And if Koch were writing this book today, I’m fairly certain he’d help you skip all that.) An ungodly fraction of the rest of [book: ppk on JavaScript] is devoted to the basic syntax details of JavaScript — for-loops, while-loops, and the rest. Any experienced developer is going to skip right over these.

It *is* a valuable book if you want to understand the fundamentals beneath your jQuerys and Node.jses and such. I’m sure it’ll be good to have on my shelf to grab when I encounter some corner case. But over time, the difficulties covered in [book: ppk on JavaScript] are getting hidden more and more beneath frameworks, and pushed out of existence as browsers become more standardized and websites drop support for old browsers. So [book: ppk on JavaScript] starts to look like a dated catalog of the bad old days.

__P.S.__: It’s a small nit, but I really did enjoy this line of Koch’s: “Frankly I don’t believe that Internet over mobile phones will ever amount to much in Europe and North America”. [book: ppk on JavaScript] came out in late 2006; the iPhone came out in mid-2007. Talk about bad timing. This convinces me (as if I needed any more convincing on this point) that playing the tech prognosticator is a mug’s game.