Practical JS Projects

2 comments | Posted: 4 September 07 in Books, by Nathan Smith

Practical JavaScript, Dom Scripting, and Ajax Projects This past weekend, I finished reading the book entitled Practical JavaScript, DOM Scripting, and Ajax Projects by Frank W. Zammetti. As the lengthy name implies, it covers a variety of hands-on examples using JavaScript. Frank has done a good job of presenting several self-contained projects, and keeps them entertaining by interjecting his own unique brand of geeky humor throughout. It is geared toward those who are programmers at heart.

Though penned with programmers in mind, the book is made approachable by its conversational writing style, and the lighthearted cartoons which illustrate the main points of each chapter. The illustrations were done by Anthony Volpe, a graphic artist from Pennsylvania. Below is an sample, depicting JavaScript’s awkward days of being disrespected by other “serious” languages.

JavaScript's early days

With the dawn of Ajax however, we all now know that JavaScript has come into its own. That of course, is what this book is all about. Among the projects you will build while reading this book are a working in-browser calculator, a Yahoo and/or Google maps mash-up, a drag-and-drop shopping cart, and even an arcade style video game. Ajax is covered, as are several JS libraries: Dojo, Mochikit, Mootools, Prototype + Scriptaculous, Rico and YUI.

As might be expected, the scrpting logic is solid throughout, with Zammetti hailing from a programming background. He even diagrams all his examples in UML for ease of comprehension. I did feel that some of the inline event handling could have been done away with. I could understand his reasoning for an occasional inline function call, but things like onmouseover don’t really belong embedded in HTML anymore. The code on page 201 also worried me a bit.

<div id="divInitializing" class="cssInitializing">
  <center>...Initializing Contact Manager, please wait...</center>

Instead of using multiple line-breaks, he could/should have done something like CSS Vertical Centering. Anyway, it’s not a huge deal, but experience tells me that people are more apt to take a demo and run with it, rather than figure out the proper solution on their own. What might be intended as a proof-of-concept could haphazardly find its way into the wild as code used in production.

I wouldn’t let that nitpick deter you from reading this book, as the programming principles are very well thought-out. Just have your markup thinking cap on as you read through, as some of the HTML isn’t necessarily 100% semantic. That being said, I would highly recommend this book to someone who is familiar with JavaScript, but wants to take their skills up a notch from the bygone days of DHTML, into the realm of re-usable and extensible DOM scripting.

Discuss This Topic

  1. 1 Nick Gagne

    Avoiding inline JavaScript is one of the best things you can do when starting a project. It may not seem like a big deal when working with a few simple events, but as the project grows things can get a lot harder to manage. So, get in the habit now, and you’ll be glad you did.

    It seems funny to see all those line-breaks with all that CSS offers. I’ve seen that kind of markup in so many programming books and you really just have to overlook it and take what you can from the code.

  2. 2 Nathan Smith

    Nick: I agree, sometimes programming books can overlook the finer nuances of good client-side code. It’s like eating a piece of fish with a few bones in it. You just have to pick around them in order to get to the good stuff.


Comments closed after 2 weeks.