55 of 61 people found the following review helpful:
3.0 out of 5 stars
decent introduction, marred by typos, November 9, 2006
This review is from: Learning JavaScript (Paperback)
As an introduction to javascript, this book covers all the ground you'd hope it would. It introduces JS in the context of a standalone programming language with its various procedural constructs, before moving onto the Document Object Model and Browser Object Model, touches upon objects, and finds the time to explain Ajax. Finally, there's a whistlestop tour of the commonly used JS libraries like Dojo, Prototype and script.aculo.us. Shelley Powers also sprinkles her opinions on JS best practices throughout, with a bias towards favouring accessibility over whiz-bang flashiness. I would recommend being comfortable with XHTML and CSS as a prerequisite for this book - something like O'Reilly's own Head First XHTML and CSS would be very suitable.
If, like me, you know a few programming languages, but nothing about JS, and wanted a crash course so you could understand what all the fuss about the likes of Ajax or the Google Web Toolkit is, this is just what you need. So why am I only giving it three stars?
First, I thought some of the features weren't very well explained - the writing lacks clarity when describing important points. Compounding this, a few of the examples are poorly chosen. Some of my quibbles may seem picky, but the feel of the book is that it's pitched at an inexperienced programmer, and a lot of the time I only followed the discussion because I was already familiar with the material from other languages. Some particular points follow.
i) Accessing the length of various parts of a multidimensional array is illustrated with:
alert(threedPoints[2][2].length); // prints out 3
alert(threedPoints[2].length); // prints out 3
alert(threedPoints.legnth); // prints out 3
ignoring the error on the third line (more on that later), as can be seen from the comments, a three dimensional array has been created where every dimension is of length 3 - surely making them of unequal size would have been more illustrative.
ii) The example of the associative array manages to be even worse:
assocArray["one"] = "one";
assocArray["two"] = "two";
I struggle to think of an example that could be more misleading.
iii) While the author recognises the importance of regular expressions, and goes into reasonable detail, the material is not terribly well organised, and the examples become complicated too quickly.
iv) The section on chained constructors, and the use of call and apply is also unclear - disappointing, given I was most interested in the prototype style of object creation that JS uses.
v) The callback functions of Array are not well described. The function Filter, apparently, "ensures that elements are not added to any element unless they pass certain criteria". So, elements are not added to any element - huh? wha? Those familiar with the likes of Lisp, Python, and especially the iterators in Smalltalk and Ruby will be able to pick up what's going on, but newcomers may be baffled.
vi) The attempt to explain recursion is weak. Admittedly, most programming books do a bad job, but what's here is far too short to be useful. An illustrative quote is: "think of each iteration of the function call as pushing the string and numeric sum onto a stack, and when the numeric array has been traversed, the string and number have to be popped up through the stack to the top". I'm not saying this is wrong, but I do not believe that someone who's just been introduced to recursion would find this description helpful.
vii) Not all the programs have their output shown. This wouldn't be easy for some of the more complicated examples, but a lot of them are text-based.
Second, there are lots and lots of typos in the book. When even a JS noob such as myself spots them, you know there's something up. Fortunately, they're only minor, and they generally aren't sufficiently bad to mislead. As an example, when function literals are introduced, the rather vital keyword 'function' is missing, but the examples quickly clarify the matter. However, elsewhere, some of the code won't actually run as presented (as early as the second example, alas), and it does take the shine off the production. Either the technical reviewers were asleep, or the editors at O'Reilly ignored them. Someone ought to be embarrassed, at any rate.
None of these things are sufficiently show-stopping for someone who knows a little programming, so I would still recommend this book before wrestling with enormous tomes like David Flanagan's JavaScript - The Essential Guide, or a dedicated Ajax book. Complete beginners and the inexperienced, however, should look elsewhere, I'm afraid.
Help other customers find the most helpful reviews
Was this review helpful to you? Yes
No
20 of 23 people found the following review helpful:
2.0 out of 5 stars
NOT for beginners!, June 5, 2007
This review is from: Learning JavaScript (Paperback)
I recently purchased this book based on a lot of the positive feedback it had received in comparison to other JS books. However, after reading the book I was sorely disappointed and here's why:
1. Book is Full of Errors -- Over 400 Errors to be Exact...
This book is full of errors, both in the code samples as well as in the explanations. This is further solidified by the fact that the book's accompanying errata page (found via the O'Reilly web site) currently lists 400+ official and user-submitted errors and amendments to the book. I think I speak for every consumer when I say that purchasing a technology-based book with a bunch of errors is simply unacceptable and a total waste of money.
While many of the errors are simple and are relatively easy to fix if you're an experienced programmer, most of them may vex readers that are new to JS and programming in general. I buy a book of this caliber to learn and NOT to fix somebody's code samples.
2. JavaScript...What JavaScript?
The majority of this book deals mainly with programming practices and standards, most of which you can find online or in other manuals. I purchased this book to learn more about JavaScript but instead got a manual on object-oriented scripting, and many techniques that are impractical when applied to JS.
3. Vague Code Samples
The book suffers greatly from ambiguous code samples that introduce concepts that are not clearly explained or not explained at all. Again, if you're an intermediate programmer or have had experience with JS in the past, you may be able to decipher the cryptic code samples in this book. Otherwise, seek another source to truly learn JS from the start, such as "The Book of JavaScript, 2nd Edition: A Practical Guide to Interactive Web Pages."
Overall, this book had a couple of decent chapters that answered some questions that I had about JS. But the reason I purchased the book was to learn JS from the start. I made the safe assumption that this book would help me accomplish my goal since it's clearly called "Learning JavaScript." Ultimately, I learned only one new thing (towards the end of the book) that dealt with some AJAX and DHTML. I highly suggest reading another book first then perhaps revisiting this one later.
Help other customers find the most helpful reviews
Was this review helpful to you? Yes
No
19 of 23 people found the following review helpful:
5.0 out of 5 stars
More than a beginners book!, December 2, 2006
This review is from: Learning JavaScript (Paperback)
Based upon the title, you would think that it's a very basic beginners JavaScript book, but you would be wrong. When I first started reading the first 10 pages of chapter 1 I knew this would be a great edition to my ever growing library of JavaScript books. This book covers the very popular scripting language from a programming perspective, not like a "here's how to create a variable and use document.write to the page".
Just within the first chapter the author talks about development tools such as the Firefox JavaScript console and Firefox DOM Inspector, and accessibility. Not the normal first chapters I have read in other JavaScript books. The book has a couple introductory chapters on the syntax basics such as Data Types and Variables (Ch. 2), Operators and Statements (Ch. 3), Objects (Ch. 4), and Functions (Ch. 5).
Though these chapters really give you a lot of detail on the technical aspect of the language such as: equality with strings and objects, ternary operator, FIFO queue array techniques, anonymous functions, function closure and memory leaks. These more advanced topics I've never seen before in basic introduction chapters before. It was really interesting re-learning the basics with reviewing some new techniques and ideas.
Then the book focuses on events, event bubbling and event handlers (Ch. 6) and forms and JIT Validation (Ch. 7). The JiT validation is a technique that is has been done a long time with JavaScript (validation after every form field entry) and has been usually replaced with form submission validation but the author has some good techniques with adding event listeners that may change your mind about it.
The next chapter (Ch. 8), the author reviews using cookies, but also talks about alternative storage techniques like using Shared Object (SO) in Flash. This is only briefly mentioned but is something in never even heard about before so it was just interesting to think about another technique. Also, a practical application for SO storage was talked about with the Dojo.Storage component by Brad Neuberg that is a very popular in many Ajax toolkits. It kind of wets the appetites for more information, though. Additional topics of interest talked about in Chapter 8 were Cross-Site Scripting (XSS) and how to prevent similar type of JavaScript attacks that are gaining popularity like SQL Injection did a few years ago.
The meat and potatoes of the book are the chapters on DOM (Ch. 10) and Creating Custom Objects (Ch. 11), Ajax Basics (Ch 13), APIs (Ch.14). This is where you get practical knowledge on all the new things these "JavaScript libraries are doing. There's too much information to summarize these chapters but believe me they are worth the price of the book alone.
Unless you are a JavaScript expert, this is a book that you should buy to bring up your skills up to speed. A must buy!
Help other customers find the most helpful reviews
Was this review helpful to you? Yes
No