JavaScript: The Good Parts



Price: $19.79 Usually ships in 24 hours


JavaScript: The Good Parts (O\'Reilly Media, Inc.) - December 2008 Publisher: O'Reilly Media, Inc. - December 01, 2008

ISBN-10: 0596517742, ISBN-13: 9780596517748

Author: Douglas Crockford


153 pages

One of the top-selling books


JavaScript: The Good Parts - book reviews: 59



Book Description
Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that's more reliable, readable, and maintainable than the language as a whole-a subset you can use to create truly extensible and efficient code.

Considered the JavaScript expert by many people in the development community, author Douglas Crockford identifies the abundance of good ideas that make JavaScript an outstanding object-oriented programming language-ideas such as functions, loose typing, dynamic objects, and an expressive object literal notation. Unfortunately, these good ideas are mixed in with bad and downright awful ideas, like a programming model based on global variables.

When Java applets failed, JavaScript became the language of the Web by default, making its popularity almost completely independent of its qualities as a programming language. In JavaScript: The Good Parts, Crockford finally digs through the steaming pile of good intentions and blunders to give you a detailed look at all the genuinely elegant parts of JavaScript, including:

  • Syntax
  • Objects
  • Functions
  • Inheritance
  • Arrays
  • Regular expressions
  • Methods
  • Style
  • Beautiful features

The real beauty? As you move ahead with the subset of JavaScript that this book presents, you'll also sidestep the need to unlearn all the bad parts. Of course, if you want to find out more about the bad parts and how to use them badly, simply consult any other JavaScript book.

With JavaScript: The Good Parts, you'll discover a beautiful, elegant, lightweight and highly expressive language that lets you create effective code, whether you're managing object libraries or just trying to get Ajax to run fast. If you develop sites or applications for the Web, this book is an absolute must.



Most helpful customer reviews

Book rating: 4 Worth it for Intermediate JS Programmers

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.


Mitchell C. Amiano
10 February, 2010


Book rating: 4 A good book on JavaScript

A very good introduction to JavaScript. It only deals with the language itself, and doesn't worry about DOM scripting or implementation details and inconsistencies in different browsers; you'll need a different book for that.

Alexey Romanov
01 March, 2010


Book rating: 5 Unique Approach

I love this book. Mr. Crockford covers a ton of very usable information in a relatively small volume. If you are the kind of developer who likes to be spoon-fed popular programming idioms, you might want to look elsewhere. If you want to master the nuts and bolts of JavaScript, this elegantly condensed and filtered version of the ECMAScript specification is probably for you. I would welcome a similar treatment of Python and Ruby. The author's no BS approach is refreshing.

Dragon_71
13 November, 2009


Book rating: 5 Sound advice on coding to Javascript's strengths rather than fighting them

This book is another in the series of books lately reclaiming Javascript as a powerful language that hasn't gotten it's due (see Stefanov's book for another good example). Crockford makes a great case for Javascript not needing to please the crowd of class based languages and instead using it's prototype functional roots to their max to achieve similar ends (code reuse, inheritance, private data..). His examples showing how to do class styled coding in javascript (though using prototypes in the inside, as that what the language has to offer) followed by a more pure object to object prototyping really sends the point across in comparing elegance and benefits of the latter over the former within Javascript's rules.

I found chapter 5 on the inheritance techniques to be way harder than the other chapters in the book. But after digesting some of it, I proceeded on to the next chapters. They did not build on it so much as they were covering other domains of the language, so it's not a show stopper to understand the rest of what crockford is after to show you which are of course "the good parts" in the other domains (regular expressions, built in objects...). I return to the fifth chapter periodically to further understand everything that's going on there and pick up something else each time.

It was also nice to have the "avoid this" opinion sections entitled "awful parts" and "bad parts". While some may be disputable, it's good to get a heavyweight's reasons on why to avoid them if possible.

The code is usually light and nicely explained. The errata in the oreilly site patch up the few oopsies here and there. I feel definitely more energized to write prototype based Javascript and learn some Ajax libraries without being afraid to peak in at their source if need be now and then.

Y. Maman
07 October, 2009


Book rating: 5 Short and to the point!

No messing with the DOM in this book! Here you learn the core syntax of Javascript in an easy to read way, while staying away from the pitfalls of the language.

I read it in a matter of two days, and I really feel more confident about my Javascript with this knowledge under my belt.

Combine this with one of the books on jQuery and you could be a rockstar in no time at all!

Consider one (or several) of these books:
Learning jQuery 1.3
jQuery in Action
jQuery UI 1.6: The User Interface Library for jQuery


Robin Smidsrød
22 July, 2009