PASZ.COM LABS

Wednesday, November 02, 2005

Book Review: DOM Scripting by Jeremy Keith

Pro: Clear, concise, and up-to-date coverage of a thorny topic. Focus on "Best Practices".
Con: Narrow in scope.

Jeremy Keith's DOM Scripting serves as a worthy companion to Web Standards Solutions. Assuming only a basic knowledge of HTML and CSS, he provides an introduction to JavaScript syntax, and then takes the reader through various methods of enhancing and manipulating web pages with JavaScript (what used to be called DHTML). Topics covered include dynamic content generation, style manipulation, and simple animation. The author book also makes a concerted effort to teach the "right" way to write script, using unobtrusive, browser-independent techniques.

The topics are presented in a straightforward style that makes the more complex aspects of the DOM and JavaScript easy to understand. Keith is always explicit about why he is using a certain approach, for example when explaining the pros and cons of the innerHTML property. Unlike many programming books, which dump page after page of code on the reader with only a small paragraph of explanation at the end, Keith is very thorough about going through his code, breaking each function down line by line, and then showing the full listing at the end. Readers who already have some programming experience will have no trouble following along, however, complete novices may first need to work through a book that spends more time on the basics of programming. Though there is a short reference section at the end, additional materials will be necessary for anyone planning to get serious about web development. JavaScript topics not directly related to DOM scripting (cookies, history, regular expressions) are not discussed.

A number of chapters are devoted to building a web site for a fictional band called Jay Skript and the Domsters (you can see the final product here). I often find lengthy examples aren't useful, but in this case the site is generic enough to be easily adaptable to other purposes. Also the author breaks the example down in such a way that one can work through only parts of it and still learn quite a bit. All of the code is available for download from Friends of Ed.

Advanced readers will find this book useful as a "style guide" for writing better code. In particular the author shares unobtrusive ways to set up event handlers and to deal with browser compatibility issues. Client scripting is still very much an evolving field, and the author should be commended for his attempts to standardize some of the techniques. But those looking for a detailed reference on building complex AJAX applications will not be satisfied by the meager chapter at the end of this book. Also, it's worth noting that the graceful degradation approach advocated here has not yet been completely embraced as a standard the same way CSS standards have. (A dissenting opinion can be found here.)

Rather than trying to be all things to all people, DOM Scripting sticks to the topic at hand, and does an excellent job explaining it. I would highly recommend this book to anyone who is comfortable building HTML pages and is ready to get into scripting. Advanced coders, looking to update and refine their skills will also find it useful.

8 Comments:

Post a Comment

<< Home