Digital Web Magazine

The web professional's online magazine of choice.

ppk on JavaScript

Got something to say?

Share your comments on this topic with other web professionals

In: Reviews > Book Reviews

By Mike West

Published on November 13, 2006

Book cover: PPK on JavaScript Very few development resources have embedded themselves in my brain to the degree that Peter-Paul Koch’s QuirksMode has. His was one of the first websites I ran across that tackled programming for the web in a rigorous way, and the time and care he put into the construction of massive cross-browser compatibility charts was both obvious and appreciated. In a sense, his new book ppk on JavaScript is a continuation of the work he’s done on QuirksMode, introducing and explaining the concepts behind unobtrusive JavaScript programming in a voice that’s uniquely his.

The Audience

This is a book that can safely be handed to anyone with the desire to bend the behavioral layer of a website to her will, and is fairly bursting with concrete explanations of best practices that solidify the guru’s understanding while gently guiding the neophyte toward the mountaintop.

However, it’s fair to say that the book doesn’t waste time explaining the truly basic syntax of JavaScript. Koch expects his reader to be fluent in both HTML and CSS, and to be at least vaguely capable of coming up with a hand-waving explanation of what a piece of script does, if not how it actually works. These criteria, I think, cover the majority of potential JavaScript developers: everyone from HTML template designers to “hard” server-side programmers pressed into service on the front-end of the company’s new website.

ppk’s Approach

The thing that initially impressed me about the book was its methodology. I’ve seen many books that attempt to build specialized example scripts to fit each chapter or section, crafting fairly abstract situations that require the precise thing that’s just been discussed. This is a great way to drill specific bits of knowledge into the reader’s head, but is a fairly miserable way of instilling an understanding of the concepts’ practical use.

In contrast, Koch has extracted eight scripts from commercial projects he’s built for real-world clients. These example scripts form the logical core of the book, and each chapter specifically examines a piece of each. Instead of building examples around the material he thinks he should probably cover, he’s crafted the explanations around the concepts he knows you need in order to successfully meet clients’ requirements. The emphasis is on the real world, and everything in the book pushes in that direction.

Each example script is then examined from chapter to chapter on a thematic basis, illuminating a specific concept from several angles. When discussing JavaScript’s event system in Chapter Seven, for example, Koch begins by laying down an overview of current browsers’ event systems. After this detailed explanation of the concept itself, he jumps into each of the example scripts to explain the design decisions and implementation details. I think this material is some of the most valuable stuff in the book, since he’s not only teaching you how to practically use events, but is also giving us a peek at the decision-making process that goes into designing and building a working project. He points at a problem, discusses possible solutions, and settles on the preferred implementation, thus guiding us in our future work.

Highs and Lows

I found the discussion of the DOM in Chapter Eight to be particularly strong. He has a deep understanding of the DOM (due, no doubt, to his enormously in-depth work on cross-browser compatibility tables), and it really shines through in his explanation of JavaScript’s interaction with the structure and content of a web page. He clearly walks through the basic idea of the web page being parsed by the browsers as a tree and all that entails, while also providing solid instruction about the best ways to manipulate that tree in a clean, unobtrusive way that works across browsers. It’s good information, well presented, as is the vast majority of the book.

However, I think Koch falls into the typical programming-book trap of explaining a bit too much historical background before moving into the real meat of the topic. I understand why it can be a valuable exercise, but I think parts of the book’s introductory chapters are bogged down with information that simply isn’t relevant enough to the process of creating working web pages today. These sections stand out in my mind only because the book’s programming content is so solidly practical and useful.

Conclusions

ppk on JavaScript is a well-written and cleanly structured walk through useful JavaScript examples. It is extremely practical, and goes right to the core of what a web programmer needs to know about JavaScript to build real sites, right now.

In essence, it reminds me of how I learned to work on the web in the first place: careful examination of other people’s work. At its best, this book is a clearly annotated view source of Koch’s projects. It’s a comprehensive exploration of Koch’s thoughts about the problems he’s run into (problems that you’ll run into, too), how he approached them, and ultimately how he’s solved them.

Got something to say?

Share your comments  with other professionals (0 comments)

Related Topics: Browsers, Programming, Scripting

 

Mike West abandoned suburban Texas' wide open plains in 2005 in favour of the Black Forest in Southern Germany where he currently lives and works. His musings about the web are periodically posted to his personal website, mikewest.org.

Media Temple

via Ad Packs