Scope and Closures – Book Review

I recently got my hands on a copy of Scope and Closures by Kyle Simpson which is published by the fine folks at O’Reilly Media. I wanted to share my thoughts on the book and whether or not I would recommend it to Developers who may be newer to JavaScript or have some experience with the language, but need a thorough explanation on Scope and Closures in JavaScript.

The book is part of a series called You Don’t Know JS which is intended to explore the more esoteric parts of the language.

For the positives, the book is very well written. It was an easy read and the author explains the concepts he is covering very clearly. I feel that he uses the right amount of repetition to explain a subject without going overboard.

I have a pet peeve in that most tutorials or coding books in the market use really trite, overly simplistic examples. For example, how many of you have seen the “Calculator” tutorial when learning about TDD? It drives me nuts because it in NO WAY teaches you anything useful. I understand you’re not going to build a CMS from scratch or whatever, but something a little better than an adding function would be nice.

I am pleased to report that the author does use meaningful examples that you are likely to encounter in your work. Yes, he does use some trivial examples, but he uses them in a way that shows you the concept in code and then follows it up with a real example. I like this very much and it scored a lot of points with me.

I don’t want to just list of the Table of Contents, so I will just go over the bigger concepts covered in the book and rate them accordingly. The book starts off with a detailed look at how JavaScript works under the hood. He goes in-depth on the phases that JavaScript goes through when it is compiled and executed. His explanations hit a really nice zone where they are detailed, but not to the point where you might as well be reading the JavaScript source code. They are described in plain-english and they really give you a firm understanding and lay the groundwork for what he will be explaining later on in the book.

With a sound foundation in Compiler theory, he then moves into Lexical Scope and Scope in general. He maintains his style of explaining ideas in a clear way and follows up with nice examples.

He springboards from scope to Hoisting and then finally to Scope Closure. It may seem odd at first glance that he saved Scope Closure to the end, but it makes perfect sense after reading the book. When I was reading the last section on Scope Closure, it felt like the entire book was leading up to that. In some coding books, I feel like you can skip entire chapters and not suffer for it, with this book however, that is not the case. Every chapter serves a purpose and contributes to the rest of the book.

In terms of negatives, there really isn’t anything bad about the book. There were a few instances where the grammar needed some more editing. By this I mean that there were a few awkward sentences which required me to read it repeatedly.

The negatives are minor however and don’t take anything away from the book. A few grammar quibbles from a grammar Nazi like myself shouldn’t be enough to dissuade you from buying this book.

Overall, this book is an excellent read for Developers who are ready to take their JavaScript to the next level. If you feel lost looking at some of the frameworks on GitHub and have a hard time understanding what they are doing with Scope and Closures then this book is like a prescription for glasses that bring JavaScript into a sharp focus where the language at times can seem blurry and unrecognizable.

You can buy a copy of the book here.

Don Marges

Don Marges

Fullstack Web Developer

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin