Today we finally announced and released Closure (or Closure Library as the JS library is officially known as).
Me and Dan Pupius started the JS library at Google a long time ago. At the time there was a lot of good JS code at Google but there was really no order to it and the code was spread out all over the code base. This of course made it hard to discover which in turn lead to the same code being reimplemented over and over. As you might guess the code that existed was not very consistent and sometimes did not even work in the presence of other code. Closure was an attempt to bring a closure to this mess. The name is also a play on the programming language feature as well as the desire to make our js library be a closure of all the existing js code at Google.
At the time we were considering using Dojo as our base for this new library. We were very impressed with Dojo but back then Dojo was too unstable and we had heard too many horror stories of upgrade migration head aches. We also looked at MochiKit which was more stable but it did not really solve any of our problems. (*)
We have had more than 400 Google engineer contributing code to Closure. The code is constantly evolving but I feel like it has stabilized a lot over the last year or so. It is used by almost all of Google’s web applications and the amount of QA and usage these apps have is unheard of for any web application.
I hope we can see more code being shared among the different open source JS libraries out there. We would love to be able to
goog.require some Dojo code (especially their data model code) and I’m sure they would love to be able to
dojo.require our data structures and i18n code.
Closure relies heavily on the Closure Compiler to concatenate files, doing static type analysis, as well as code optimizations such as inlining and dead code removal. Closure Library is great for prototyping but it gets slow real fast due to all the network request that are done at startup as well as downloading all the code that you do not really need. The compiler solves both these problems.