Hacker News new | comments | show | ask | jobs | submit login
Closure: The world's most misunderstood JavaScript library (gmosx.com)
26 points by gmosx 2598 days ago | hide | past | web | 14 comments | favorite

    Among other things, I learned that:

      the powerful type system eliminates a large class of bugs the compiler eliminates the long name spaces (and the corresponding run-time look ups)
      getters/setters actually lead to better compression
      you can split the client side code in multiple, independently loaded modules
      the pseudoclassical pattern used for OOP is actually better than the functional pattern (when combined with the Closure compiler)
      you can easily extend the Compiler with extra features...
These sound very interesting - it'd be good to have an explanation of these points.

And you can get an explanation by reading the book mentioned in the article or by reading the documentation at http://code.google.com/closure/ .

I really suggest you buy the book mentioned in the article. The author discuses extensively (and, to me at least, convincingly) the design decisions behind Google Closure.


I've been using the compiler for months, slowly adding type annotations as I went, but not really "getting" a few key concepts.

Investing in the book was worthwhile, especially since it's the only source for documentation for certain types of compiler optimizations or the module functionality.

I'm always wary of posts like this. It's tagged as book review but there isn't much detail about the book in question. It is effusive in it's praise of the book but gives very little detail of why the book is good. And it contains two affiliate links to the book that it mentions. On second reading, it looks like a post that just exists to try to generate affiliate clicks for the book in question.

This is no review, it's a post about Google Closure, a great library that I think deserves more exposure.

I like the Closure compiler but not its templating library or its dom library. The dom library is not abstract enough (you have to explicitly create dom elements) and I generate all my js files via my own php based templating library that is a lot more powerful and concise.

A great combination for the front end through is CoffeeScript + the Closure compiler + jQuery (or your favorite dom library).

I am not sold on the templating library either. But the Closure library is quite extensive and abstract. It contains tons of useful (and well designed) UI components and compares favorably to something like jQuery UI. On the other hand there is a higher barrier of entry due to the lack of adequate documentation.

What templating library do you recommend?

Well, I am using my own templating library, normal-template: http://github.com/gmosx/normal-template

It's similar to json-templates but with a few extra tricks. You can find some documentation here: http://www.nitrojs.org/normal-template

I'd like to read the article, but I consistently get the "this page has become unresponsive" error. Not really a ringing endorsement for a Javascript library. :)

I am not sure why you have problems to access the page. Works ok for me. Try again! This has nothing to do with Closure though, it's not used in the page ;-)

AFAIK he's using jQuery for the blog page. Probably compressed with Google's compiler, but still.....


Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact