An unfair review of Goodman's JavaScript Bible

The sixth edition of Danny Goodman’s JavaScript Bible is a painful book. It’s painfully long, at over 2 inches thick and almost 1,200 pages--not including the seven “bonus” chapters that are on the included CD but not in the printed book. It’s painfully difficult to read because: (1) the type is very small; (2) the paper is cheap and dull and gray instead of white; (3) some of the headings are set in a gray halftone; (4) the code listings are set in a font so spindly that I had to look at it through a magnifying glass to convince myself that it wasn’t halftone; and (5) sections of text that outside the main narrative have a mottled gray background meant to look like stone, which make the text not only difficult to read but childish in appearance.

The CD includes a PDF with the entire book and the bonus chapters. Because my screen is whiter than the book’s pages, and because I could increase the magnification, this is the first book I’ve found to be easier to read on a computer than on paper.

Content? It starts off pretty poorly. This is the first script:

     1:  <html>
     2:  <head>
     3:  <title>My First Script</title>
     4:  <style type="text/css">
     5:  .highlight {color: red}
     6:  </style>
     7:  <script type="text/javascript">
     8:  function showBrowserType() {
     9:      document.getElementById("readout").innerHTML = 
    10:      "Your browser says it is: " +
    11:      "<span class='highlight'>" +
    12:      navigator.userAgent + "</span>.<hr />";
    13:  }
    14:  window.onload = showBrowserType;
    15:  </script>
    16:  </head>
    17:  
    18:  <body>
    19:  <h1>Let's Script...</h1>
    20:  <hr>
    21:  <h1>Let's Script...</h1>
    22:  <hr />
    23:  <div id="readout"></div>
    24:  </body>
    25:  </html>

The heading and horizontal rule are doubled on lines 19-22, the repetition probably coming as the book’s listings were changed from HTML to XHTML. It’s the kind of mistake that’s easy to make, but it’s rough on your readers when the very first bit of code has an error. The PDF has the same mistake, but a separate folder of scripts on the CD has a copy of the script without the repeated elements.

Worse than the editing error is the complexity of the script. There’s a function, some DOM access and setting, and an onload handler. The JavaScript is about as far as it can be from where its output will be placed. And there’s some gratuitous CSS. It’s not as straightforward as a simple document.write("Hello, world!") in the body of the page. It doesn’t keep the code, the static content, and the presentation style in separate files, as is preferred by most web developers today. It’s just a mess. And it’s followed by three pages of explanation. It’s the first script for first-time programmers and it takes three pages to explain.

After reading this script, I decided, unfairly, that this was not the book for me. I skimmed the other chapters but never came across anything that made me regret that decision.

I’ve been meaning to mention that Shelley Powers, the author of Learning JavaScript, emailed me about a month ago after reading my unfair review of her book. She was very gracious about my criticisms, a graciousness you don’t often see on the Internet. I hope she gets a chance to revise Learning JavaScript. There’s a need for a well-written introductory JavaScript text, a need that the JavaScript Bible--with all the inertia of six editions behind it--will never fill.

Tags: