/>
X
Tech

GWT fireside chat

I'm still wading through all the notes I took at the Google I/O 2008 conference last week. If you want to see pictures, check out my flickr photoset (183 photos).
Written by Ed Burnette, Contributor on

I'm still wading through all the notes I took at the Google I/O 2008 conference last week. If you want to see pictures, check out my flickr photoset (183 photos).

While I was there, I went to two sessions called "fireside chats". Although there was no fire involved, both were great; in fact I think these chats were the highlight of the whole gathering. The first one was hosted by 4 engineers on the Google Web Toolkit (GWT) project:

GWT fireside chat
From left to right: Bruce Johnson, Robert Vawter, Miguel Mendez, and Rajeev Dayal.

Everybody else sat around on bean bags and regular folding chairs. Most of the meeting was taken up by Q&A interaction with audience members, but I'll start with a list of GWT 1.5 features. As you may know, GWT 1.5 release candidate was announced on the first day of the conference.

Features of GWT 1.5

The most visible change in GWT 1.5 is support for all the Java 1.5 syntax and semantics, including generics, parameterized wildcards, and so forth. This had to be supported not just in the compiler, but in the Generate subsystem and the RPC. All the @gwt.typeargs stuff from 1.4 is unnecessary in 1.5; in fact you get a warning asking you to remove that.

GWT 1.5 adds rules and states to widgets for accessibility. This lets screen readers for the blind do something more interesting than reading out table TD tags.

Another new feature is...

Continue reading "GWT fireside chat"...

Javascript overlay types. There was another talk called "Surprisingly rockin Dom and Javascript with GWT", which covered this but I didn't make it. Basically GWT 1.5 uses this feature to build an entirely new DOM API library for GWT. In 1.4 you had to do DOM.createElement, Dom.createChild(x,y), etc.. You really wanted to do x.appendChild(y), and now you can do that in GWT 1.5.

In 1.5 you get a Javascript object from the wild and subclass the JS object class in GWT without having a wrapper around it. Subject to a couple of rules that becomes an overlay on top of a live JS object. The GWT compiler eliminates any extra indirection on top of the class. For example in Dojo if you want to directly bring types into the Java type system, you can do that with 1.5. There are now lightweight collections classes. JS arrays now directly model as Java array. It also has a fast string map.

Deep JS method inlining is a nice new feature, which has made JS overlay zero cost. You can see JS methods hoisted out. In 1.4, if you had a native method it was always a function call. In 1.5 it may be hoisted out to call site. In Java it might look like multiple function calls but by the time it gets to JS it might not really be.

Plural forms: 1 egg, 2 eggs, 3 eggs, etc. is supported. Now you can have the internationalized message, and it selects right pluralization. 1.5 has all the plural forms for a lot of languages.

Longs. In GWT 1.4 longs didn't work right; it just did doubles, which can't faithfully represent the full range of a long. In 1.5 it does software emulation of full 64 bit range for longs. This makes longs slower, but more correct. If your code worked fine with old longs and you'd rather have the speed, simply change your source code to use double instead.

An interesting tidbit: GWT 1.5 had a relatively long 9 month cycle. It took Scott Blum 5 days to do the 1.5 compiler stuff, and the rest was libraries, accessibility, i18n, etc..

Q&A session

Q. My GWT site is not showing up on Google search, what do I do? A. Crawler could run Javascript, try to simulate what the browser was doing, but it wouldn't necessarily be the best solution. What you want is for people to discover you. Have a static HTML intro page, use that as a launching point. GWT doesn't have to own the entire page. You can have as much HTML as you want generated on the server side.

Also you can push data into the Google back ends using Google base. It will be incorporated into the crawled back ends search results.

Q. How difficult is it to go from Javascript programming back into Java programming? A. When you go from JS to Java, you have all the tools to do code completion for you. You can use that to determine what to call. If you make a mistake, the compiler helps you out. It might be irritating at first but you at least know where you're going wrong. Easier to go from JS to Java. You may think it seems easier to go the other way (from Java -> JS) but it only seems that way.

To realize the full potential of GWT you need to get good at using your IDE: code completion, refactoring, hierarchy browser, etc.. Focus on learning an IDE (Eclipse, Netbeans, IntelliJ, etc.) really well.

Continue reading "GWT fireside chat"...

Q. Should I use Gears and worker pools to send and store data locally? A. It's a good approach. Galgwt (GWT bindings for existing apis) supports Gears. It's more manual right now because the debugging for workers isn't there yet.

New doc for 1.5 uses a documentation reader for google code which is really a prototype doc reader for Google Gears. it fetches content in the background, and may make a good example. Google may open source it for that purpose.

Q. Would that be better than deferred commands? A. You should do both, in case user doesn't have Gears.

You can use deferred binding to build Gears and non-Gears versions.

Q. Can you use GWT with the Google App Engine? A. Yes. Ongwt.com did a load test challenge that used this. It's python on the back end so you can't use regular RPC.

Q. Will there be native support for the app engine including debugging? A. Sometime. You can still do some debugging even though you don't have a Java back end.

Q. Ever thought of controlling all HTML? A. Read the "Making GWT Better" document. It's not a walled garden, but rather "a lot of leverage on top of a rocky landscape". You only pay for what you use.

"GWT has a library. GWT is not a library. You can use other libraries with it."

Q. For a visual genome browser I need pretty pictures you can click around and do stuff. Image and map are separate, and thus inefficient. Ideas? A. Maybe you could try image bundles? click widgets?

In Ajaxian, there was an example that combined downloading an image with other data. You use the data url send back a string, JSON data and image, then set source of image to the data url. Another way encoded data in the image, drew it into the canvas, used getPixel to get the data out (moans from the audience). One audience member suggested piggybacking something in http headers, maybe in a cookie.

Q. GWT 1.5 has a new Animation API. Trying to modify dialog box animation, even to just change interpolation is hard. Will that be opened and made more extensible? A. Yes. The reason we didn't do it that way is we needed to get some amount of animation to get out of the box themes to look nice. Designing an API that is meant to be extended is a different undertaking. Through feedback we'll come to the right design.

Continue reading "GWT fireside chat"...

Q. Why is host mode slower than real browser mode? A. There is a large number of function context switches. Scott Blum's "flaming sword of death" branch, speed up 1.5 hosted mode to make it not painful.

There is also some working going on to have a new Eclipse plug-in that precomputes some things so hosted mode will start up more quickly.

Q. Date picker in gwt incubator is nice, will you have more? We're using mygwt and extgwt. A. Yes, next release will have data picker, scrolling tables, paging tables, others. But really there's no reason not to use packages like mygwt and extgwt. We don't claim to have all the right solutions. We have a lot of constraints on code we release, for example it has to be industrial strength. You may not need all that, so use whatever works for you and passes your legal/qa dept.

Q. What IDE do you use? (this question got a lot of laughs) A. 3 of the presenters answered Eclipse, and the other answered IntelliJ and Eclipse. When asked why other IDEs weren't used more, the consensus was that documentation was lacking. The googlers said they'd like to get patches for documentation on using GWT with other IDEs.

Q. Model is service layer. I want to send those beans to cleaner, how can we make the RPC layer ignore them, in particular annotations, Jaxws annotations. I have been using the 1.5 nightly version from the trunk. A. It should be ignoring annotations if there is no source code. could be a bug.

Q. Is JSIO going to be standard? If not then what should we use. A. First look at 1.5's new Javascript object.

Q. Can you use GWT on Android? A. Yes. Ray Cromwell is doing a talk on GWT extreme, including how to integrate with Android. Android has a WebKit browser.

Editorial standards