Start reading JavaScript: The Good Parts on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here.

Deliver to your Kindle or other device

 
 
 

Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Read books on your computer or other mobile devices with our FREE Kindle Reading Apps.
Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 

JavaScript: The Good Parts [Kindle Edition]

Douglas Crockford
4.2 out of 5 stars  See all reviews (199 customer reviews)

Digital List Price: $23.99 What's this?
Print List Price: $29.99
Kindle Price: $9.60 includes free wireless delivery via Amazon Whispernet
You Save: $20.39 (68%)

Formats

Amazon Price New from Used from
Kindle Edition $9.60  
Paperback $16.73  
Unknown Binding --  
Shop the new tech.book(store)
New! Introducing the tech.book(store), a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now

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.


Customers Who Bought This Item Also Bought


Editorial Reviews

About the Author

Douglas Crockford is a Senior JavaScript Architect at Yahoo!, well known for introducing and maintaining the JSON (JavaScript Object Notation) format. He's a regular speaker at conferences on advanced JavaScript topics, and serves on the ECMAScript committee.


Product Details

  • File Size: 1054 KB
  • Print Length: 176 pages
  • Simultaneous Device Usage: Unlimited
  • Publisher: Yahoo Press; 1 edition (December 17, 2008)
  • Sold by: Amazon Digital Services, Inc.
  • Language: English
  • ASIN: B0026OR2ZY
  • Text-to-Speech: Enabled
  • X-Ray: Enabled
  • Lending: Enabled
  • Amazon Best Sellers Rank: #7,889 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  • Would you like to give feedback on images?

Customer Reviews

I recommend this book to anyone planning to do professional JavaScript development. Jeremy D. Burman  |  60 reviewers made a similar statement
If you want to learn or even if you think you know Javascript this is the book to get. R. Cottrell  |  26 reviewers made a similar statement
Most Helpful Customer Reviews
422 of 431 people found the following review helpful
Format:Paperback|Amazon Verified Purchase
Do you struggle when creating objects in Javascript?
Do you find the syntax to be non-intuitive and frustrating?
Do you know the difference between using a function as an object vs using an object literal?
Do you know how using object literals can simplify your code and create something similar to namespaces?
Do you know how to augment the type system -- for example, if wanted all strings to have a trim() method?
Do you know why the "new" statement is so dangerous? Do you know an alternative that eliminates the use of "new" entirely?

These are some of the topics that the book touches upon.

This book is aimed at someone with intermediate programming experience that wants to know the best way to create and use objects, arrays, types, etc. Crockford takes his experience with Javascript to show you best practices coding techniques and styles to use with Javascript. In addition, the book provides insights into what makes Javascript so confusing and what can be done about it.

You might ask "Isn't this stuff already covered in other books that I have?" The answer is no. For one, most other books use a psuedo-classical coding style (see below) to explain objects that is a source of confusion.

Javascript can be very confusing, especially for programmers who have extensive experience in other C-based languages (like myself). Writing good Javascript that uses objects, methods, etc. is hard. In Javascript, if you want to create objects, use inheritance and create methods, you have several different ways to write your code and it's difficult to know what the strengths and weaknesses of each are.

Crockford explains the problem plainly. Other C-based languages use class inheritance (Crockford calls this classical inheritance). Javascript, on the other hand, is the only popular language that uses prototype inheritance, which does not have classes. However, the syntax which Javascript uses to create object is Java-like (Crockford calls this pseudo-classical syntax). It's confusing, because it keeps you in a class-based frame of mind while working in a language that has no concept of classes.

Clarifying what's going on with the object model is the best part of this book. Crockford also explains other parts of Javascript that can be problematic and the techniques that he prefers for handling them. I don't necessarily agree with all of them, but the important thing is that he explains his reasoning.

To effectively learn Javascript, I recommend that you buy 1) a book that covers the details of the language and can be used as a reference (e.g. Javascript, the Definitive Guide) and 2) Crockford's book. Advanced programmers might also enjoy Pro Javascript Design Patterns, which shows a number of ways to combine Javascript with some of the GoF patterns. I would avoid any cookbook style books on Javascript, because you're better off using YUI, JQuery or one of the other Javascript libraries than writing your own drag-and-drops, calendars, etc.

There are a series of Yahoo! videos by Crockford that mirror the material in this book and can be found as podcasts under YUI Theater. They contain nearly all of the material in the book and probably a little more. Those videos are:

- Douglas Crockford/An Inconvenient API: The Theory of the DOM (3 parts)
- Douglas Crockford/The JavaScript Programming Language (4 parts)
- Douglas Crockford/Advanced JavaScript (3 parts)
- Douglas Crockford/Javascript The Good Parts
Was this review helpful to you?
99 of 104 people found the following review helpful
5.0 out of 5 stars Beautiful book May 16, 2008
Format:Paperback|Amazon Verified Purchase
This is a beautiful book.

First of all - at only 170 pages it is short. Even though some of the key points are repeated through the book it's dense with information. You don't need any JavaScript experience, but it's not a "beginning programming" book so if you haven't been programming before this is not the right book for you.

Reading this book a couple of times will give you an appreciation for the JavaScript language that you almost certainly didn't have before. It'll give you tools to write better programs that you and others will actually be able to maintain over time.

I've learned lots of little things that I maybe knew from experience, but now I _know_ and I know why.

This book will help you battle with JavaScript rather than against it.
Comment | 
Was this review helpful to you?
93 of 102 people found the following review helpful
Format:Kindle Edition|Amazon Verified Purchase
I'm a long-time C, C++, and Java programmer (videogames, predominantly) learning Javascript to do some web work, so I picked up this book because the reviews were good and the notion appealed to me - learn the subset of this rather sloppy language that you can use as a good language.

My TL;DR version of the review: this book is a hodgepodge of different information about the language, but some of it is so complicated it'll go immediately over the heads of new programmers, and then some of it is so mundane (even pedantic, talking about very specific aspects of coding styles) it felt goofy and out of place. It seems to me that any specific individual reading this book won't really find more than one or two chapters very relevant. I give it 3 stars because the useful parts were useful to me, but I skimmed and ignored 80+% of the book.

Crockford's writing is personable and clear, and the book's organization is straightforward. Here's my chapter-by-chapter breakdown. Note that this is all from my perspective, what I personally found useful or not, but my point is, while other readers will certainly disagree with me about what was useful, I have trouble imagining any one person finding more than about 20% of the book useful.

Chapter 1 is an introduction and high-level explanation of the point of the book.

Chapter 2 covers basic grammar and the likes, which was helpful though it's not aimed at any particular familiarity with other languages so it's trying to be comprehensive, which meant that as an experienced programmer in other languages I had to skim it and just look for differences with what I'm already used to.

Chapters 3 and 4 were the most useful parts of the book for me: the section on objects and functions, data scoping and closure, which really takes a new way of thinking if, like me, you have a lot of experience with languages without closure and anonymous functions and the like. Crockford does a good job of explaining this and giving relevant examples. This section was 20% of the book and was the only section I found really useful.

Chapter 5 covers inheritance. He presents two methods, one using new and constructors like one of the languages I'm more used to, and gives a couple reasons to avoid this, and then digs into the prototypal method, which is unfamiliar to me. The problem is that he uses totally abstract examples here - classes representing animals and methods that return their names or the noises they make - and it was very hard for me to relate it to any actual application, and since the prototypal style is a fundamentally different paradigm I don't feel like I really grasped it from his writing. Since he builds a framework of extension methods throughout the book, once I started to lost his train of logic I was utterly lost. And the "meta" nature of javascript, assigning functions to methods that return other functions that wrap functions, I found it easy to get lost.

Chapter 6 covers arrays. If you've used scripting languages this stuff is very simplistic, a stark change from Chapter 5, which is quite sophisticated. Again, my point here - I don't know who would simultaneously understand Chapter 5 and still find anything in Chapter 6 useful.

Chapter 7 is a significant change of direction; it's a long chapter on regular expressions which I skimmed very quickly since I know them from using perl. This part seemed odd, since regular expressions are common to several languages, and there's nothing particularly unique about javascript's usage of them. It felt a bit misplaced in this book. Certainly they're an important part of the language, but again made me wonder: who's the book for?

Chapter 8 is a reference for core API functionality and his extension methods; this feels like stuff I'd just google while coding, not terribly valuable to me personally.

Chapter 9 is a diversion on coding style, and felt wildly out of place and kind of insulting: if this book is for a seasoned programmer this is just going to trigger unpleasant flashbacks to arguments you had back when you were a junior programmer. If you're a new programmer and this stuff is news to you, other chapters in the book are going to be utterly incomprehensible to you.

Chapter 10, "The Beautiful Parts," is all of a page long, but a nice summary of the good aspects of the language.

Appendices A and B cover some of the "Awful & Bad Parts" of javascript in detail; this was the second-most interesting part of the book to me, though it's brief and you've picked it up if you read the rest of the book. Still, definitely value here. Though worth noting: he inserts some more editorializing here, ala Chapter 9 - he calls out some things that aren't specific to javascript, like switch statement fallthrough, as bad parts, which I found annoying. Stick to aspects unique to javascript and point out real dangers instead of offering advice on very broad aspects of coding style, I kept thinking.

Appendix C is about JSLint, the lint for javascript. It was useful only in the sense that I didn't know JSLint existed, and now I do, but then he gives a long swath of what amounts to JSLint documentation, which I have to imagine exists on the JSLint site, and felt like filler.

Appendix D is about JSON and just some reference information about the format. Maybe useful, but no authorial insight, just docs.

Overall, glad I read it, but I was pretty underwhelmed given the generally great reviews of the book on here.
Was this review helpful to you?
Most Recent Customer Reviews
3.0 out of 5 stars Not a manual
It is not a Javascript manual. It is some chat about Javascript. It may be nice to discuss some topics for those who already knows the language, but it will not teach you. Read more
Published 2 days ago by Dimitri K
5.0 out of 5 stars One of the standard books for JavaScript
This is one of the standard books for JavaScript but it is not for the inexperienced. John Resig's "JavaScript Ninja" is more approachable if you are learning JavaScript... Read more
Published 3 days ago by Richard Groot
2.0 out of 5 stars Overpriced for a limited reference.
I should have just bought the O'Reilly reference book. In fact, after looking at the reference I will go buy that on my next purchase. Read more
Published 5 days ago by Craig W Shaver
4.0 out of 5 stars Good, but not for beginners as stated.
I'm teaching myself Javascript and I bought this book because I was told it was for beginners. I'd been struggling to understand some of the concepts, and then I found an online... Read more
Published 11 days ago by K. Lewis
5.0 out of 5 stars Fantastic reference book, would recommend
Whilst I haven't used it extensively, it has already proven itself an invaluable addition to my programming bookshelf. Read more
Published 22 days ago by C. Browne
5.0 out of 5 stars Amazing!
This book is no nonsense and jam packed with amazing information about javascript! If you ever wanted to know anything about it, read this book. Read more
Published 22 days ago by Broderick
5.0 out of 5 stars Very informative and entertaining
As a javascript newbie I found this book really useful. The examples are simple and concrete, they are carefully explained which is very nice. Read more
Published 1 month ago by Pablo
5.0 out of 5 stars For programmers
Excellent book.
Written for programmers.
Straight to the point, no fluff.
Every computer topic should have a book like this.
Published 1 month ago by Jack
5.0 out of 5 stars Best briefest cleanest JavaScript Book Ever
Douglas Crockford is the man. He's on the JavaScript standards board, and focuses on how clean maintainable stable javascript can and should be written.
Published 1 month ago by Stuart Williams
5.0 out of 5 stars Opened My Eyes To JavaScript
Like many old-school Programmers (with capital P), I always felt JavaScript was a "messy" language with horrible browser implementations and poorly planned, incompatible... Read more
Published 1 month ago by Sean Y. Chou
Search Customer Reviews
Only search this product's reviews

More About the Author

Douglas Crockford is a Senior JavaScript Architect at Yahoo!, well known for introducing and maintaining the JSON (JavaScript Object Notation) format. He's a regular speaker at conferences on advanced JavaScript topics, and serves on the ECMAScript committee.

What Other Items Do Customers Buy After Viewing This Item?



Forums

There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
Topic:
First post:
Prompts for sign-in
 



So You'd Like to...


Create a guide

Look for Similar Items by Category