Home

“JavaScript: The Good Parts” Book Review

Posted by patorjk | Book Reviews,JavaScript | Thursday 31 December 2009 5:08 pm

JavaScript: The Good Parts

JavaScript: The Good Parts

Last month I finished reading the short but densely packed JavaScript book JavaScript: The Good Parts.I had been looking for a book that would cover some of the pitfalls of the language more thoroughly than what I’d read about previously and when I saw this in the bookstore it seemed to fit the bill.

The thesis of the book is that JavaScript is a misunderstood language. It recognizes that there are bad parts to the language, but it contends that once you get past them there are some pretty nice good parts – and that by using only the good parts and avoiding the bad parts, you can write some really great code.

The book covers objects, functions, arrays, regular expressions, closure, and how inheritance works in JavaScript. The last one is probably the most important, since most people are only familiar with classical inheritance, and JavaScript’s prototypal inheritance, although wrapped in a syntax that makes it look classical, is very different. The book also discusses JavaScript’s bad parts and why you should avoid them.

Most of the concepts in the book are well explained, though I did find myself needing to re-read certain sections twice to completely understand the topic. This is in part because the book is very short, coming in at 153 pages (including the index). This is a double edged sword in that it allows you to take in a lot of material in a short amount of time, but sometimes you’re left wishing that a little more time was spent on a certain topic.

One other possible fault with the book (depending on how you look at things) is that it does not cover the DOM at all. The DOM isn’t part of the JavaScript language, but almost everyone who uses JavaScript will need to interact with the DOM. Therefore, this book is really more of a companion piece than a definitive reference for JavaScript programming.

Overall I really liked this book. It gives good coverage to some important topics regarding objects and functions, and gives a good explanation of prototypal inheritance. A lot of language quarks are also pointed out and explained. For example, one thing I didn’t realize was that the arguments array that is implicitly passed to functions isn’t a real array. It’s just an object with a length property. The appendix sections covering the “bad parts” and “awful parts” were also pretty interesting, though I disagree with the author that ++ and — are bad.

Anyway, I highly recommend the book if you’re into JavaScript programming. It’s a nice easy read that covers a lot of ground. Also, this is a non-solicited review, though the link above is an amazon referral link.

If you’re interested, the book’s author gave a one hour talk on this book that touches on a lot of its ideas. You can watch it here (actual talk starts at 2 minutes 15 seconds):

Merry Christmas and Happy Holidays!

Posted by patorjk | Introspective,Personal | Thursday 24 December 2009 10:08 pm

I’ve been bad about updating the past couple of months, I should have some interesting stories for next year though.

It’s been a pretty amazing year. I got engaged, bought a house, wrote a couple of new web apps, learned a lot about Tcl and JavaScript, visited Northern California (and then got stranded in Phoenix on my way back – due to the blizzard going on in Maryland), worked over 180 hours of overtime, and gained a lot of weight (the last one’s not a good thing, but it’ll give me a goal of losing weight for the new year).

I looked up my resolutions for this past year and I think I did ok. Here’s the list:

  • Get good at JavaScript: I feel like I’ve accomplished this one. There’s more for me to know, but I feel like I really know my way around the language.
  • Learn jQuery: Didn’t even look at it this year. There are a lot of cool JavaScript frameworks out there though. I’ll probably get around to learning jQuery at some point, but I don’t think knowing it is as important as I used to.
  • Develop More Web Apps: The Typing Speed Test, the HTML Canvas game, the Blog Stylometry Tool, and lots of updates to the Keyboard Layout Analyzer. I was sort of quiet near the end of the year, but I expect for things to pick up again here soon.
  • Read At Least 4 Programming Books: Learning Dojo, Learning ExtJS, JavaScript: The Good Parts, and Code: The Hidden Language of Computer Hardware and Software. JavaScript: The Good Parts and Learning ExtJS were the best of that group, and after thinking more about it, probably the only two I’d recommend from the list.
  • Join A Programming Community: I did not do this, unless you count my subscription to the Programming Sub-Reddit at reddit.com. I’ll give myself half credit here.
  • Write A WordPress Plug-In: I had a couple of ideas, but I lost interest.
  • Release Some Programming Examples: I still want to do this.

So I achieved 3.5 of my 7. Not too shabby, I feel like I accomplished what was important to me, and that’s probably better than meeting the goals I think up at the beginning of the year.

This probably wont be my last post of the year (I’ve got a book review coming), but I hope everyone out there has a great holiday and a happy new year!