Posts Tagged: web development

Book Review: Javascript: The Good Parts by Douglas Crockford

The phrase “JavaScriptmaster” and Douglas Crockford are considered synonymous in the web development world. When I heard that Crockford was writing a book on JavaScript, especially a guide to the better features of one of the most maligned (and perhaps abused) but popular languages in the current web development industry, I was sure I wanted to read that book. I opened the book with very high expectations and unsurprisingly, I was not disappointed one bit.

With the recent explosion in the usage of JavaScript, the interest in JavaScript is at an all time high. When Netscape, which created JavaScript, released the specification of the language in the mid-nineties, it was unable to define a robust and complete specification for the language due to pressures of rushing out a production release. As a result, fair chunk of the language is not well thought out which contributes to bad programming style and promotes some bad programming practices. It is not the programmers but the language which causes this. Programming models based on Global variables, JavaScript eval, inconsistencies in variable scope, and confusion regarding how objects are created and handled in JavaScript can all be the sources of programming errors and give rise to bad programming practices.

This book, as its name suggests, focuses on the “Good Parts” of the JavaScript while cautioning the readers against the “Bad Parts” of the language. All the  above mentioned “bad parts” and many other programming constructs are cautioned against in a two-part appendix.

Two other appendices also touch  on JSLint, the powerful JavaScript syntax and program correctness verifier and JSON, the preferred and increasingly popular text data exchange format. These two chapters give a taste and a starter for two very important support tools for JavaScript.

However, the meat of the of the book focuses on the better parts of the JS language. In ten chapters, Crockford explains why features like – JS inheritance model, prototypes, objects, arrays and how the language handles regular expressions – are very useful and make JavaScript a fairly powerful language in its own right. Object Oriented programming in JS, how methods and the prototype chain is handled and can be used to write clean and powerful code are all a must read for advanced JS programmers.

The language of the book is very simple and sprinkled with illustrative source code which makes understanding the concept in discussion easy to understand. That said, this is not a beginners book. This book is aimed at those who have programmed in JS and have a working knowledge of the language. Nevertheless, it is a highly recommended book for anyone looking to get into better and more powerful JavaScript programming.