JavaScripts: The Good Parts

I recently picked up JavaScript: The Good Parts by Douglas Crockford. Douglas is a senior JavaScript architect at Yahoo! whose work with JavaScript has inspired JSON. In JavaScript: The Good Parts, he presents the best features of JavaScript that have made it ubiquitous while omitting those imperfections that have given the language its bad rap. The good parts include loose typing, object literals, object model, prototype inheritance, and closures. The bad parts are the global variables, DOM, browser incompatibility, lack of block scope, eval, lack of real arrays, and to many falsy values (0, NaN, “”, false, null, undefined).

Perhaps adhering to that famous proverb that says if you can’t say anything nice, don’t say anything at all, JavaScript: The Good Parts is a slim book and a quick read. JavaScript: The Good Parts is one tenth the size of JavaScript: The Definitive Guide. Even with its small shelf space footprint this good has plenty of good parts, such as the following…

Most programming languages contain good parts and bad parts. I discovered that I could be better programmer by using only the good parts and avoiding the bad parts.

How can you build something good out of bad parts?

JavaScript is a block of marble, and I chip away the features that are not beautiful until the language’s true nature reveals itself.

It turns out that strong typing does not eliminate the need for careful testing. And I have found in my work that the sorts of errors that strong type checking finds are no the errors I worry about.

Obsolete comments are worse than no comments.

Generally, the craft of programming is the factoring of a set of requirements into a set of functions and data structures.

Software is usually expected to be modified over the course of its productive life. The process of converting one correct program into a different correct program is extremely challenging.

It turns out that style matters in programming for the same reason that it matters in writing. It makes for better reading.

Features have a specification cost, a design cost, and a development cost. There is a testing cost and a reliability cost. … Features have a documentation cost. Every feature adds pages to the manual increasing training costs.

Features that offer value to a minority of users impose a cost on all users.

Douglas Crockford has numerous technical presentations for learning JavaScript and written Twelve Elements of JavaScript Style.

Technorati Tags: , , , ,