Well I just finished reading the book Prototype & Scriptaculous in Action to learn my first javascript library. Up until now I’ve been picking up small pieces of code here and there and writing my own library as needed. I was curious what one of the “big boys” would do differently so pre-ordered this book from Amazon when I saw it was being released.
The book is structured such that the reader sees how things can be done without the library then shows how the library can improve those features. So this isn’t just abook focused on the Prototype and Scriptaculous libraries. It also teaches some basic javascript concepts. I suspect this is a good approach for the target market of this book. I would imagine many people looking at this book wouldn’t have the basics down so would benefit from this structure. I have a pretty solid javascript foundation so it wasn’t really necessary although I did read most of it and caught a few new tidbits were hidden in there. So if you are an experienced javascript programmer the book is a fairly easy read.
As for the libraries themselves, Prototype is largely based around making it easier to work with the browser including creating some consistency in cross browser functionality. These improvements include making it easier to do object oriented programming in javascript, adding functionality to arrays, and providing many helper functions for common tasks like interfacing with the Document Object Model (DOM).
Scriptaculous, on the other hand, is largely about visual effects. This library allows the user to have elements in the browser move, grow, shrink, fade, among other effects. It also creates some easy controls to implement a slider bar and an ajax suggestion input text. The feature I liked best was the drag and drop ability. It was very easy and satisfying especially after having created my own that still lacked a significant amount of functionality.
The book did a good job detailing these features and helping the reader learn how to use them. One of the ways this was done is through the use of a series of “labs”. These labs are webpages that can be downloaded to a local system and lead the reader through the functionality and options of the different tools and controls. The labs made it very easy to understand how the parts worked and what they could do.
The only real problem I had with the book was the errors. I realize it was just released and in its first printing, but there are a significant number of typos and minor errors that can be frustrating as a reader. For example, in chapter 8 the screen shots from the labs are all out of order. I found myself flipping through the book to find the right screen shot then had to flip back to look at the code on a different page.
Still the book was definitely worth reading if you are either interested in working with these two libraries or if you have no experience with javascript libraries in general and wonder what the big deal is about. Although I haven’t yet looked at YUI or jQuery or Dojo or Mootools, I think I now have a good idea what they can do (although I’m sure the details of the implementation differ).
I give this book 4 stars out of 5. :)
david_kw


