4 ms·
I wonder if the Closure library (and related tools) will gain more traction now that it has been used for Google+. Any reason why more companies/projects use th
by famoreira 15y ago
I wonder if the Closure library (and related tools) will gain more traction now that it has been used for Google+. Any reason why more companies/projects use them?
- udp 15y agoYes, I'd actually never heard of Closure until I read this. I wonder how it compares to jQuery/jQuery UI?
- bgarbiak 15y agoI don't think these can be compared fairly. JQuery is a simple, small and focused library while Closure is a big, all-in-one type of thing.
- ma2rten 15y agoEDIT: It is definitively only for full fleshed java-script web apps, not for quickly adding some gimmickry to a static webpage. As it happens I just started looking into it a few days ago. Here is what I found: The closure compiler really is it's biggest advantage. It compiles your code to really optimized javascript, with not one character too much. Only the parts of the library that you can actually use are compiled into your app. Also the library is pretty much extensive. For example their i18n code looks quite good. The downside (in my mind) is that it forces a quite verbose java-like programming style on you (classes with getters/setters etc.). You also have to annotate your code with type information (a la javadoc) to take full advantage of the compiler. Also the DOM APIs are really ugly. They basically look like the bare browser apis. Their is not really a big community around it either. But also means that nearly every line of code is actually used in a google application. I havn't decided yet if I should use it for my next project.
- murz 15y ago> You also have to annotate your code with type information (a la javadoc) to take full advantage of the compiler I consider this an upside, especially on large JavaScript products with many engineers contributing (like the ones Google builds). Having your JavaScript checked at compile time helps ensure quality code, and helps to avoid errors at run time.
- ma2rten 15y agoI guess you are right, especially if you work in a team and want to build well documented, maintainable code. On the other hand it can be a bit tedious, if your main goal is to build a rapid prototype kind of thing.
- daredevildave 15y agoWe started our current project using jQuery/jQuery UI and I found that it didn't feel up to the task. We're creating a complex single page application with many controls, etc. Things like menus, tree controls, etc, just don't exist in standard jQuery UI. And the plugins were mostly unsupported. I got up and running with the Closure library, very quickly, and I'm still finding it nice to use.
- nikcub 15y agoClosure has been available for a while and is being used with Maps, Gmail, Docs, Reader etc. so I don't see why the addition of another Google product would make a big difference in adoption. It is a large, full-featured framework, comparable to sproutcore, cappuccino or EXT. It ties in a lot with Java and (update: not GWT: I must have missed this since I never used GWT). I tried it, but found that I prefer a lighter stack of loosely coupled libraries (eg. backbone + mustache + zepto)
- nl 15y agoActually it doesn't tie in with GWT at all. It's kind of weird - there doesn't seem to be anyway at all to use the Closure components from GWT without a lot of work.
- nikcub 15y agothans for clarifying. I have never used GWT but assumed or picked up somewhere in the docs that closure worked with it
- nl 15y agoClosure has it's own Javascript compiler (that does some type checking and minimisation). It's likely that is what you are thinking of - you'd hardly be the first.
- ma2rten 15y agoWhy do you prefer a lighter stack? Do you use other libs in your current stack, e.g. for internationalization or dependency loading?
- nikcub 15y agoit comes down to understanding everything you are using, and being able to swap out components for something better. ie. it is very unlikely that a single framework has the best router, controller, selector, templating etc. but by assembling your own stack you can inject personal preference and what you consider 'best'. I do the same thing on the server side as opposed to using Django
- wccrawford 15y agoI'd heard of it before, but hadn't really taken it seriously. I guess it's time to start. It's been used in enough of Google's main apps now that it's probably pretty stable.