 |
Book Reviews of JavaScript: The Good PartsBook Review: JavaScript: The Pretty Good Book Summary: 3 Stars
I'm not sure what I thought this book would be; I guess I assumed it would be along the lines of "C Traps and Pitfalls". At times, however, it seems almost more like an essay.
Certainly, parts of the book are worth five stars. I was especially pleased to see the author's treatment of how null, undefined, and NaN all relate to one another in unexpected ways -- something that has puzzled me in the past. It was also good to see a list of the reserved keywords, some of which I didn't know before, and concrete examples of the dangers of == and != versus === and !==.
An unexpected treat was to read his discussions on the technical aspects and slowness of arrays, bitwise operators, and "with" statements in JavaScript, and the origins of "switch" in FORTRAN IV, and JavaScript's similarity to Lisp, despite its outward resemblance to C.
It was also bemusing to see his example of "flight.equipment && flight.equipment.model" on page 21, as I also learned that same lesson while working on a flight-related application.
Yet, for the head Javascript guy at Yahoo, it seems that a few things are missing. For example, while he does say on page 80 that slice() creates a shallow copy of an array, he does not make it explicitly clear that array2 = array1 will effectively create a pointer, i.e., a copy by reference. To make a truly independent copy of an array, one needs array2 = array1.slice() (no arguments necessary). This caused me a day of frustration when I first learned it.
And was it not Yahoo themselves that determined that scripts should come at the end of a web page to improve load speed? Why is that not in here?
We also have nothing about compression techniques.
On the web, for free, one can read Andy King's superb 2003 article on "Optimizing JavaScript For Execution Speed". And most of the discussion on objects can be learned much more succinctly and with better examples from MDC's "Core JavaScript 1.5 Guide".
One can learn a lot about download optimization from Dean Edwards.
Chapter 4 (Functions) was good; Chapter 2 (Grammar) did nothing for me.
I was also a little disappointed with Appendix B, "The Bad Parts". Most of this dealt with undisciplined programming as opposed to flaws with the language itself. E.g., "switch" statement fall-throughs are bad. Are they? If one of your people creates an unintentional fall-through, then deal with him; don't blame the language. Does Crockford also believe that firearms should be banned because of the potential of misuse, even though they have a valid purpose? How about steak knives? This is kind of like Edsger W. Dijkstra telling us that we can never use GOTO, even though it does have its place.
Further, I've used "continue" statements effectively, albeit not so often. Maybe I'm a bad programmer?
And then, he advises against autoincrements!! (++)
Regarding style, the book is definitely filled with the usual O'Reilly collegiate pompousness that's often good, sometimes not-so-good.
In summary, there are some good parts, but as a whole this is yet another pricey programming book from which I only needed 10 pages.
If you're at the plateau of understanding that it's actually the DOM that's slow and inefficient, and that Javascript is only guilty by association, and that it's actually an elegant little language, then there's probably something in this book for you.
Book Review: Thinking in Javascript Summary: 5 Stars
This book is for Javascript programmers who have perhaps been at the novice level and now wish to jump up to an intermediate understanding of the language. The language is small but unconventional, and this book tries to help you get your arms around the meatier parts of Javascript. The book tries to get you thinking in Javascript. The author shows you the components of the language and then shows you ways of putting those components together that say something about the design of the language overall. Then, you can go on to designing your own solutions. This is not a reference book and it is not certainly not exhaustive in its discussion of Javascript and its quirks. Instead, this book just contains the things that are really important. It is a rather small book, but it is very clear and illustrative in the concepts that it does cover, and the included examples are complete solutions, not just a line of code here or there. The table of contents are not shown in the product description, so I present that next:
Chapter 1. Good Parts
Section 1.1. Why JavaScript?
Section 1.2. Analyzing JavaScript
Section 1.3. A Simple Testing Ground
Chapter 2. Grammar
Section 2.1. Whitespace
Section 2.2. Names
Section 2.3. Numbers
Section 2.4. Strings
Section 2.5. Statements
Section 2.6. Expressions
Section 2.7. Literals
Section 2.8. Functions
Chapter 3. Objects
Section 3.1. Object Literals
Section 3.2. Retrieval
Section 3.3. Update
Section 3.4. Reference
Section 3.5. Prototype
Section 3.6. Reflection
Section 3.7. Enumeration
Section 3.8. Delete
Section 3.9. Global Abatement
Chapter 4. Functions
Section 4.1. Function Objects
Section 4.2. Function Literal
Section 4.3. Invocation
Section 4.4. Arguments
Section 4.5. Return
Section 4.6. Exceptions
Section 4.7. Augmenting Types
Section 4.8. Recursion
Section 4.9. Scope
Section 4.10. Closure
Section 4.11. Callbacks
Section 4.12. Module
Section 4.13. Cascade
Section 4.14. Curry
Section 4.15. Memorization
Chapter 5. Inheritance
Section 5.1. Pseudoclassical
Section 5.2. Object Specifiers
Section 5.3. Prototypal
Section 5.4. Functional
Section 5.5. Parts
Chapter 6. Arrays
Section 6.1. Array Literals
Section 6.2. Length
Section 6.3. Delete
Section 6.4. Enumeration
Section 6.5. Confusion
Section 6.6. Methods
Section 6.7. Dimensions
Chapter 7. Regular Expressions
Section 7.1. An Example
Section 7.2. Construction
Section 7.3. Elements
Chapter 8. Methods
Chapter 9. Style
Chapter 10. Beautiful Features
Appendix A. Awful Parts
Appendix B. Bad Parts
Appendix C. JSLint
Appendix D. Syntax Diagrams
Appendix E. JSON
If you are new to Javascript I suggest starting with Head First JavaScript (Head First). Once you have read that book, get this book and become someone who thinks in Javascript. At the same time, get JavaScript: The Definitive Guide for the best reference on the language that is in print.
Book Review: A few gems, but too much filler Summary: 3 Stars
This book has some good parts, even some great parts. Many parts of Chapters 3, 4, and 5 are very insightful, and might revolutionize how you think about Javascript, even programming in general. (Unless you come from a Lisp or functional programming background, in which case the insights will be old hat to you).
Unfortunately, the book as a whole seems to suffer from an identity crisis, or a lack of effort by the author to craft a consistent work, or perhaps a struggle between the author and publisher. Whatever the cause, it seriously compromised the quality and integrity of what could have been an amazing book. Instead of the tome of grand enlightenment that it should have been, we are left with a few gems buried amidst mounds of useless filler material.
The introduction explains that this is not a book for beginners, which is true, because beginning programmers would find most of Chapters 3, 4, and 5 to be completely impenetrable. Even experienced programmers may find them difficult to grasp. As the introduction says, this book is "small but dense," which is a nicer way of saying that it throws advanced techniques and code samples at the reader without sufficient explanation.
The introduction also explains that this is not a reference book, which is also true, because it does not describe the DOM at all, nor even list all the standard methods and functions built into Javascript. The introduction suggests that the reader should go look on the internet to find such references, which you'll certainly need to do if you plan to actually use Javascript for anything. But despite it not claiming not to be a reference book, the author decided in Chapter 8 to present a mishmash of standard methods, without any clear reason for why some are listed and others omitted, nor even a mention of the fact that there are others you should be familiar with.
And even though it is not a reference book or a book for beginners, a significant chunk of the book is spent explaining very basic concepts that the target audience is undoubtedly already familiar with. For example, 14 pages are spent explaining the syntax for whitespace, numbers, strings, if statements, while loops, and so on, all of which will be nothing new to anyone who has used C, C++, Java, etc. The book even provides railroad diagrams to illustrate each syntax, which adds thickness but little value to the book, then repeats them in Appendix D to add another 10 pages of pure bulk.
There is a lot of other filler material, as well, such as the appendix on JSLint, which is a slightly more polished copy of the documentation [...], and the appendix on JSON, which is a slightly more polished copy of the documentation [...], both being pet projects of the author. Neither of these appendices adds value to the book, only thickness.
If Crockford and O'Reilly were interested in offering a really great book, or even a book worth the price tag, they should have cut the filler, expanded the explanations where they are needed, and offered more insights and substantial practical examples.
But I can't really recommend the book as it is now, unless you buy it used or borrow it from a library. You would be better off with a Javascript beginner's guide plus reference to learn the basics, or proper guide to functional programming (regardless of the programming language) to learn the advanced techniques.
Book Review: Worth it for Intermediate JS Programmers Summary: 4 Stars
The reader of "JavaScript: The Good Parts" by Douglas Crockford will get a very good idea of why JavaScript is considered a runt among programming languages. Crockford does his best to model good programming patterns and style in JavaScript. It is unfortunate and telling that the book is so thin. Crockford neither pulls his jabs at the language nor dumps on it unfairly, but gives a clear rationale for his opinions.
Like JavaScript, the book is more sure of what it is not than of what it really wants to be. Readers should read the preface seriously before going further -- but ignore the contradictory second sentence stating it is for programmers working with JavaScript for the first time. The book will interest language nerds, but it really should be read by intermediate JavaScript programmers who spend too much time debugging code they should never have written.
The short chapters make the book a relatively quick read, despite the somewhat advanced level of the material compared to other JavaScript books. Upon first glance at the size of the book, I was reminded of The Little Schemer (a tutorial on the Scheme programming language). Crockford's writing is easy to read, as if you were collecting thorough notes over a long series of lunch time talks. Incidentally, the structure of the book is unlike "Little Schemer" but Crockford does touch on functional programming techniques.
This book has a strong overtone of frustration with JavaScript. That isn't a criticism of Crockford, but sprinkled throughout the material are the tell-tale signs of what could have been, or should have been, but can never, ever be. It truly gets to a head in Chapter 9, titled "Style", in which 11 paragraphs in three pages start with "I". It is personal for Crockford.
Readers should be aware that there is virtually no error checking in the code. While omitting error checks is a common practice in trade book code samples, Crockford is making a point of illustrating good coding practice. The absence of a disclaimer is odd, but several of Crockford's examples do deal specifically with faulty conditional expressions. Take his warning in the preface to heart again here: "JavaScript: The Good Parts" won't tell you everything you should be doing to write good code.
JavaScript: The Good Parts is not a real reference, but if you do sporadic JavaScript programming it may be a book you will pick up again several times. That's because it is small enough and concise enough to act as a quick reference to the stuff that really is worth using, and some of the parts that really are best avoided.
Book Review: Using the good parts will increase quality and save a lot of time and grief Summary: 5 Stars
I read JavaScript: The Good Parts by Douglas Crockford and learned a lot from it.
I feel that he makes very good points on his commentaries on the awful and bad parts of JavaScript and his suggestions to use a "good parts" subset of the language does seem to hold ground and increase quality and development time. At least, that is the case on the project that I'm working on that involves JavaScript. I seem to have fallen to just about all the pitfalls that he points out. Reading his book was a great comfort (I'm not the only one thinking that this or that aspect of the language stinks and for a good reason...) to me and his work-around suggestions do seem to be useful and practical. Along with other two very useful books on JavaScript: Bulletproof Ajax by Jeremy Keith (I have reviewed this book too on Amazon) and AJAX Security by Billy Hoffman and Bryan Sullyvan (see my Amazon review for this book too) I think that any developer that usews JavaScript can get a clear picture on the good sides and bad sides of JavaScript and clear understanding of the "do"s and the "don't"s and the implication of doing things one way or the other.
There are some mild typos in the book, that I'm sure will be corrected in future editions (e.g., pp.60: "... 'shi' has its key changed from '4' to '3'..." should be "... 'shi' has its key changed from '3' to '3'...", I believe).
Considering the fact that the author states several times that the book will avoid the bad parts and concentrate on the good parts, it is quite stressed in the book when bad parts are discussed, and some bad parts are repeatedly being mentioned and the implications of using them along with their proposed work around is also re-iterated (e.g., arguments list which is not really an Array object, or the fact that null is being identified as an object, and there are many more examples).
I liked a lot the "functional" approach, which I enjoy and like to use in many of my Perl scripts and programs, and I also use a lot in my JavaScript scripts and programs. I do find the "functional" way of doing things to be lighter and more straightforward than the classical object oriented approach that many advocate (which I don't really find very useful most of the time). For those that want a non lisp/scheme/haskell introduction to functional programming see a very nice Perl book that introduces functional programming: Higher Order Perl by Mark Jason Dominus (see my Amazon review on the book).
I really really enjoyed reading the book. I found the advise there very useful and I learnd quite a lot of things about JavaScript.
More Customer Reviews: 1 2 3 4 5 6 7 8 9 10 ›
|
 |