Accelerated DOM Scripting Book Review

[Image] Accelerated DOM Scripting Book Cover

DOM scripting is becoming more common each and every day. There have been many great books written on the subject, but I’ve got to admit, Accelerated DOM Scripting with Ajax, APIs, and Libraries by Jonathan Snook with Aaron Gustafson, Stuart Langridge, and Dan Webb is absolutely one of the better publications I’ve had the chance to read. Perhaps it’s just the writing style of Mr. Snook that I admire, but this book (while covering some technical details) was very easy to follow compared to some other books on JavaScript/DOM Scripting.

The organization of the book is spot on, and the level of technical difficulty is perfectly summed up in the title; Accelerated DOM Scripting. This book isn’t for the novice JavaScript developer. Mr. Snook found a healthy balance of covering the bases when it comes to the technology used (HTML, CSS, JavaScript), but made sure to take things to the next level with great explanations of why things are the way they are. The book is a great addition to your personal library, so I’d like to offer a quick overview of what you get.

Chapter 1: The State of JavaScript

In this chapter you’re provided a nice introduction to JavaScript and some developer jargon. While this is mostly common when it comes to JavaScript publications, this chapter is nice because you’re also provided with a great overview of tools to use during development. Tools that will help you examine, inspect, and debug your JavaScript and make your life that much easier. Some great tools are mentioned here, and I’m glad they’re mentioned as I depend on a few of the plugins mentioned every single day.

Chapter 2: HTML, CSS, and JavaScript

Chapter 2 follows suit in that an overview is provided, covering the importance of separating structure, style, and behavior. While HTML and CSS are touched upon just enough to keep the ball rolling throughout the book, JavaScript is given a bit more love. This is a book on DOM scripting, after all. The DOM is well explained using a good blend of technical writing and imagery to back it up. A number of topics are covered; regular expressions, code formatting practices, and event handling to name a few.

Chapter 3: Object-Oriented Programming

OOP has proven itself to be extremely beneficial when applied to JavaScript. This chapter elaborates on that, providing an introduction to object-oriented programming and what comes with it. The book becomes more technical at this point, providing extensive code snippets to help readers follow each topic covered. Some things touched upon include object literals, namespaces, closures, encapsulation, and functional programming (callbacks, chainable methods, and more).

Chapter 4: Libraries

This is the chapter I was waiting for. I was really excited to see an author write a book based on these JavaScript libraries which have more-or-less taken over the lives of many. This chapter explains what it is that a JavaScript library actually does. A few libraries are introduced and explained as the libraries of choice at the time of the writing. From the book:

The current leaders of the pack are the following:

  • Dojo
  • Prototype
  • jQuery
  • Yahoo! UI Library (YUI)
  • Mootools

I think we can all agree that this list is accurate and comprehensive. Mr. Snook provides an explanation of each library as well as what sets it apart from the next. He includes a bit of opinion regarding which library should be used for what type of project based on the analysis. Beyond library analysis, some of the very popular plug-ins, as well as up and coming developments are discussed as well.

Chapter 5: Ajax and Data Exchange

Chapter 5 is an in depth look at Ajax and what comes with it. The entire process is explained in detail, effectively removing any magic for any reader who wasn’t quite sure how it really worked. Data formats associated with Ajax are covered, and the differences between them are explained effectively. You’re also walked through the development of an Ajax object which can be recycled and used again in any number of applicable situations. Finally, after the Ajax process has been demystified, you’re shown how to use Ajax with the libraries mentioned in the previous chapter. I love the way this chapter came together in that all the work put into one-line Ajax calls from a library is laid out and examined in detail.

Chapter 6: Visual Effects

Let’s face it: animations are eye-catchers for clients. Beyond that, they’re eye-catchers for anyone; that’s their purpose. In the same fashion of chapter 5, the nitty gritty details of animation with JavaScript are explained before disclosing how these effects are accomplished using the set of libraries discussed throughout the book.

Chapter 7: Form Validation and JavaScript

In my opinion, form validation is absolutely one of the best ways to use JavaScript to progressively enhance a document. While client-side validation can save readers a step, the importance of server-side validation is discussed first. Beyond a validation code example, you’re also walked through a validation example using Ajax explained in great detail.

Chapter 8: Case Study: FAQ Facelift

I’m a big fan of using case studies to apply a variety of principles to a single example. Using a ‘real-life’ scenario really helps to drive a point home, and that’s just how things turn out for Chapter 8: Case Study: FAQ Facelift. A page of frequently asked questions is dissected and discussed throughout the chapter, progressively enhancing the document along the way. In the end, many of the topics previously mentioned were effectively put into practice.

Chapter 9: A Dynamic Help System

As a closure, an extremely in-depth example is provided. From start to finish, you’re walked through the construction of a progressively enhanced sidebar to provide some help to a reader. You’re walked through everything from the planning stages to implementation and the example is a fantastic way to finish the book. Mr. Snook is adamant in explaining what technology he employs for each example, continually mentioning that it’s not the only way to get things done.

In closing

What’s great about this book, is that in the end, there is no doubt about it that JavaScript libraries aren’t what make the magic happen; the JavaScript does. I’m really thrilled to have read this book and absolutely recommend you add it to your library.