Closure: The Definitive Guide

Author: Michael Bolin
Publisher: O'Reilly, 2010
Pages: 592
ISBN: 978-1449381875
Print: 1449381871
Kindle: B0046RERYI
Audience: Existing and potential users of Closure
Rating: 4
Reviewed by: Mike James 

Closure is Google's very strange JavaScript compiler - does this book succeed in demystifying it?

No, this isn't a book about the computer language - that's Clojure.

No, this book isn't about functional closures in JavaScript - that's a book yet to be written.

No, this book isn't about the psychology of emotional conclusions - that's ....




It is always a mystery why a particular word suddenly becomes overused but closure is one such. In this case the title of the book refers to Google's very strange JavaScript compiler.

Why strange?

Well compilers are usually from one language to a lesser language but in this case Closure is a compiler that compiles JavaScript to ... JavaScript. Hey! That sounds easy - I could write one of those, it's called a file copy program...

Seriously there must be more to it than this, but the big problem with this book is that it doesn't easily give the game away. The basic idea of the Closure compiler is that it lets you write elegant JavaScript - and yes JavaScript can be elegant- and it converts it into fast and efficient browser-independent code. In the process it also checks for potential problems and warns you. It adds compiler level checking to what is otherwise interpreted code. Not content with just being a compiler there is also the Closure Library which you can use to create apps without having to reinvent the wheel. There is also Closure Templates which simplify the generation of HTML from JavaScript.

Armed with the outline given above you should find the book in question much more useful. Even though it starts off with an introduction it never really manages to tell you what it's all about. It jumps in with examples that are deep into what you should know. Chapter 2 for example is on annotations for Closure JavaScript - I could have waited for this topic until after I'd mastered some ideas directly related to application building.

The next two chapters go into great detail about the Closure library. In Chapter 5 we meet classes and inheritance - standard JavaScript objects but with a few extras provided by annotations. Next we are off into event management and then a chapter on client server communications. Then we deal with UI components for no particular reason and on to debugging. In Chapter 11 we finally meet the Closure templates. 


The remainder of the book covers some mostly advanced topics that you might never need to know about. How the compiler works and how to modify it and advanced compilation, for example. Chapter 15 is on the testing framework which is of much more general interest and this more or less finishes the book apart from a collection of appendixes.

The big problem with this book is that it doesn't introduce anything in a gentle or even logical order. It doesn't really start simple and work up explaining the ideas as it goes - it simply tells you things almost, but not quite, in the manner of a reference work. As long as you have a good grasp on what Closure is all about and why you would want to use it then having this book at hand is a good idea. There is also a lot of standard JavaScript presented and while this is good if you don't know it you could also end up thinking that this is all something to do with Closure additions to the language - when they aren't.

This book isn't for the beginner and it isn't even for the slightly confused JavaScript expert. However, it is a unique resource if you are already a Closure user - in this case just buy it.



Continuous Architecture In Practice (Addison-Wesley)

Author: Murat Erder, Pierre Pureur and Eoin Woods
Publisher: Addison-Wesley
Pages: 352
ISBN: 978-0136523567
Print: 0136523560
Kindle: ‎B08ZRTQGLJ
Audience: Software Architects
Rating: 3
Reviewer: Kay Ewbank

This book sets out the case for why software architecture is more important than ever, and in p [ ... ]

Deep Learning (No Starch Press)

Author: Andrew Glassner
Publisher: No Starch Press
Date: July 2021
Pages: 750
ISBN: 978-1718500723
Print: 1718500726
Kindle: ‎ B085BVWXNS
Audience: Developers interested in deep learning
Rating: Mike James
Reviewer: 5
A book on deep learning wtihout an equation in sight?

More Reviews

Last Updated ( Friday, 02 November 2018 )