Wednesday, July 23, 2008
GXP's story begins in 2001, when I was working on an early version of Google AdWords. We had been having a lot of issues with the templating system that the AdWords Java frontend was using at the time, so I started looking around for alternatives. I made a list of some features I'd like from a Java compatible templating system, which looked something like this:
- Compile time type checking and markup validation.
- Convenient parameter passing/modularization. (our old templating system just used "includes")
- Automatic escaping of untrusted content (to protect against Cross Site Scripting attacks).
- A way to prevent "business logic" from ending up in our templates without being too oppressive.
- Easy to use internationalization support.
- A lightweight runtime, preferably not tightly coupled to the Servlet API. (so you can use it to generate email, not just web pages)
After investigating a number of templating systems, I couldn't find anything that met our criteria. I started playing around with ideas for what a templating system that met all of these criteria would look like, and I showed my eventual design to some other members of the team. They were enthusiastic about it, and our tech lead suggested that I go ahead and build it.
The original version of the compiler was written in Python and had a very tiny runtime system written in Java. We used this new language when we rewrote the AdWords system. Since then a number of other projects at Google have used GXP, including AdSense, Blogger, and Google Reader.
Over the next few years the language grew: the internationalization support was expanded, XHTML support was added (it originally only generated HTML), and the automatic escaping system was improved to significantly improve protection against XSS. About two years ago I began a complete rewrite of the compiler in Java. One of my hopes was that this would encourage users of GXP to become contributors to the compiler.
Several months into the rewrite, Harry Heymann joined in. Not only did Harry aid in getting the new compiler finished to the point where users of the old compiler could switch to the new one, but he also contributed extremely valuable new features like runtime compilation, instantiable templates, and support for generating non-HTML markup. Over the past several months Harry has also lead the effort to open source GXP.
Also, if you happen to be in Portland for the O'Reilly Open Source Convention, stop by for our presentation on Wednsday.