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 ....

 

Banner

 

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.

 

Banner


Coding for Beginners, 2nd Ed (In Easy Steps)

Author: Mike McGrath
Publisher: In Easy Steps
Pages: 192
ISBN:978-1840789751
Print:1840789751
Kindle: B0B56LN77V
Audience: Complete beginners to programming
Rating: 4
Reviewer: Sue Gee

This book aims to introduce hands-on modern programming to complete beginners. Can this be achieved in fewer than 180 [ ... ]



SQL Server Query Tuning and Optimization (Packt)

Author: Benjamin Nevarez
Publisher: Packt Publishing Pages: 446
ISBN: 9781803242620
Print: 1803242620
Kindle: B0B42SVBFY
Audience: Intermediate to advanced DBAs and developers
Rating: 4.7
Reviewer: Ian Stirk 

This book aims to give you the tools and knowledge to get peak performance from your que [ ... ]


More Reviews

Last Updated ( Friday, 02 November 2018 )