Posted by mjeffw
on September 15, 2008 at 7:21 AM PDT
My introduction to Google Web Toolkit, and the start of a series of entries on Property binding support.
This JavaOne I finally got to check out Google Web Toolkit. After hearing David Geary speak, I have to confess the next day I made a beeline to the bookstore and picked up his excellent book, Google Web Toolkit Solutions and stayed up late each night in the hotel working through the examples in the book.
One of the things I have discovered since starting to experiment with GWT is that it is missing some key framework support. That is, the basics are there: rich desktop-like widgets, a serviceable RPC mechanism, etc. But some basic support for managing a desktop application, like property binding support, is missing.
I suspect much of this is simply because the technology is still pretty young, and there's a lot of work to be done on it before it will really be able to compete against Adobe's Flex.
Still, I'm pretty stoked about this technology, and I am willing to work a bit to make up for some of the missing pieces. There is also a growing community of projects working to close up some of the holes.
As I mentioned above, one the first things I found missing in GWT was property binding. If you don't know, property binding is a way of making state changes in one representation of data show up in another representation of the same data. This is commonly done in GUI code that uses the venerable MVC pattern. For example, say you had data that represented the personal information of somebody. That data would include stuff like their first, middle, and last names, street address, city, state or region, and postal code.
In MVC, you'd have a model, an object that captured just this information. A simple Person model might look like this:
public class Person
public String firstName;
public String middleName;
public String lastName;
public String address;
public String city;
public String region;
public String postalCode;
You'd also have a GUI form that contained text controls for each one of these fields. In most GUI frameworks, including GWT, each of these controls (or widgets, in GWT terminology) contains a copy of that same data. A lot of GUI code is written that copies code from one to the other. Property binding is way to automate (some) of that boilerplate code and automatically copy the data from the first name widget to the Person.firstName field whenever the user enters a new value.
Right now, property binding support is missing in GWT. In my next few posts, I plan to talk about ways to address this shortcoming.