Picture of stu

Relevance Reviews #1: The JavaScript Anthology

  • Posted By Stuart Halloway on April 05, 2006

My in-plane reading for the NFJS Omaha trip was the recently published JavaScript Anthology from SitePoint. I picked up a copy specifically looking for resources to recommend to Ajax developers.

There is a lot to like about this book:

  • The authors clearly know their stuff, and in detail. Everything is demonstrated with code.
  • The individual tips are well-organized, with a statement of the problem, solution, and discussion. I found the format easy to skim (for stuff I already basically knew), and easy to dive in where necessary.
  • The authors provide lots of links to additional resources.

More than half of the book is devoted to effectively using the APIs that are present in a modern web browser, for manipulating the Document Object Model, forms, windows, ranges, DHTML, CSS, XHR, etc. These items will be of great value to anybody who has to write effective JavaScript in the face of browser variabilities. Most of the tips are captured as JavaScript procedures which you can easily adapt for your own programs.

Relatively less time is spent on the language itself—the intro chapter, plus concluding chapters on OO and performance. While these chapters are reasonable as far as they go, I wish they went a lot farther. Like most authors writing about JavaScript, the authors sound a bit apologetic in comparing JavaScript’s prototype-based inheritance to class-based OO. There’s no need to apologize! JavaScript provides very powerful abstractions. The best Ajax developers are embracing these abstractions, without constantly looking in the rear-view mirror at classes.

The most troubling part of the book, particularly for an Ajax developer, is the disconnect between the “procedural” style of most of the sample code, and the object-based (and functional) style of JavaScript you will see in libraries such as Prototype. Hidden in the Ajax wave is a set of programming techniques which go far beyond Ajax in their utility and importance:

  • closures
  • internal iterators
  • metaprogramming
  • AOP
  • Duck Typing
  • Functional Programming
You won’t find much on these topics here. In fairness, I am not aware of any JavaScript book that hits these. Your best bet for today would probably be to learn Ruby and transpose Ruby->JavaScript in your mind.

To sum up, this is a well-organized, solid book. It will be most useful for people writing and supporting “raw” JavaScript. Most Ajax developers should be using libraries to handle much of this low-level detail. That said, you always need solid knowledge of at least one level of abstraction beneath the one where you are working. Read the JavaScript Anthology to learn that next level down, and stay tuned for future reviews where I’ll cover some books that target Ajax more directly.

Comments
  1. MattApril 12, 2006 @ 04:06 PM
    Thank you for the kind words about our book and the review...
  2. Delhi In SexApril 29, 2006 @ 04:42 PM
    Good idea!
  3. Commercial FreezerApril 30, 2006 @ 03:58 PM
    Just thought I'd make a note about a problem :)
  4. Eminent Efficiency Laundry DetergentApril 30, 2006 @ 11:45 PM
    Thanks :)
  5. Priscilla TuftMay 01, 2006 @ 05:33 PM
    Not really new!
  6. Anti-SpamMay 03, 2006 @ 07:52 AM
    Bl00dy spammers, all spammers must die, please delete posts 2 to 5 (and mine too if you want) as they all link to sex sites.
  7. Sliding Hiatal HerniaMay 06, 2006 @ 05:52 AM
    i am not sure as to why :)
  8. Vintage Posters Mt Saint MichelMay 06, 2006 @ 11:49 AM
    I think it would be usefull for other users also!
  9. Angel E Send CardMay 08, 2006 @ 12:12 AM
    That's awesome.
  10. Computer Based Share Origin Trading ClipMay 09, 2006 @ 06:23 PM
    The problem is my browser :)
  11. Finding Nemo Type PictureMay 10, 2006 @ 04:38 PM
    Thanks...
  12. Golf newsMay 12, 2006 @ 03:40 PM
    Thanks for the write-up!
  13. Beauty Raise SvizzeraMay 14, 2006 @ 07:46 AM
    Thanks...
  14. Dissipated SystemMay 16, 2006 @ 01:43 PM
    Thats correct!