-
Get a monthly update on best practices for delivering successful software.
Google recently released the Google Web Toolkit. The basic idea behind the toolkit is that you can write AJAX applications in Java:
public class Hello implements EntryPoint {
public void onModuleLoad() { Button b = new Button("Click me", new ClickListener() { public void onClick(Widget sender) { Window.alert("Hello, AJAX"); } });
RootPanel.get().add(b); }
}
Then run it in a hosted mode for debugging:
Then compile it into Javascript for deployment:
[...]function lb(mb){cb(mb);return mb;}function xb(yb){return zb(this,yb);}function Ab(){return Bb(this);}function wb(Cb){if(Cb.toString) return Cb.toString();return '[object]';}function Db(Eb,Fb){return Eb === Fb;}function zb(ac,bc){if(!cc(bc,1)) return false;return Db(ac,dc(bc,1));}function Bb(ec){return r(ec);}[...]
The secret sauce here is that the GWT actually emulates a good portion of java.util and java.lang in Javascript. Can a full JVM implemented in Javascript be far behind?
A natural question is whether Google eats their own dogfood, i.e. do they write gmail, google maps and co. using GWT or something similar? Looking at the code from gmail and google maps, you certainly can see some similarity. Both GWT and the google application code contain lots of two letter identifiers. This points to either code generation, code obfuscation or both.
Still, none of the Java identifiers that show up in the GWT code (_.c = 'java.util.AbstractMap$4';) show up in the other code.
What does this mean? There are two main possibilities as I see it:
Looking at Google Calendar, the most recent of google's releases seems to point to possibility #2, as it doesn't really resemble the GWT code in many respects. Also, the GWT doesn't include many of the cool widgets that google has in it's own apps, like the lazy loading, draggable grid in google maps.
What could google's motive be in releasing a tool they don't lose themselves? No idea.
If anyone can point me to a google app that actually appears to be built with GWT, I'm all ears.
Update 1: XML11 is a toolkit similar to GWT in that it allows you to write Java and codegen Javascript.
Update 2: Some thoughts by Dion Almaer over at Ajaxian on GWT and XML11 and whether they are at the right level of abstraction.
Related posts:
Topics: Ajax Components, Ajax Frameworks, Ajax Tools, Frameworks, Google, GWT
I was wondering how long it would take someone to look into that. I bet the GWT evolved from the effort of trying to create a sophisticated application like google mail. I doubt they created it first and I’ll bet they stumbled at first with their efforts before creating the GWT. I’m curious, were you at the Ajax Experience conference this month?
Comment by Joshua Gertzen, Tuesday, May 23, 2006 @ 3:43 pm
I wondered the same thing myself.
Comment by Dean Edwards, Tuesday, May 23, 2006 @ 4:00 pm
Google plans do debug the client part of their web aplication frameword at cost free. They use Googlers to stress their tookit but they don’t allow them to build javascript on-the-fly like echo2 does. Its the best way to test their javascript output in a large number of diferent browsers with diferent plugins and they assure their main aplications like calendar, maps, gmail stay clean and sharp.
PS- Maybe they’ll give some of them a Google Tshi(r)t
Comment by General, Friday, May 26, 2006 @ 10:07 am