RSS Feed Subscribe to RSS Feed


TSS2009: An Introduction Google Web Toolkit (GWT)

Google Web Toolkit (GWT): An Introduction
Speaker: David Geary
David is an Author (including this book), Speaker and contributor of questions on the SCWCD exam.


David introduced GWT as a new solution for an old problem, i.e.
How to develop a rich interfaces that run in the browser

The premise:
AJAX is hard

  • Requires experitse in JavaScript, a mixture of disparate technologies
  • Integration of client and server code
  • AJAX libraries make things easier, but…

The promise:
You can develop Ajax-enabled web apps in Java

  • Implement client-side UI in pure Java
  • Very little knowledge of JavaScript required
  • Familiar idioms from AWT and Swing

Top features of GWT

  • Application generator forĀ  quick start
  • Convention over configuration (like Ruby on Rails approach)
  • Instant turnaround after changes (i.e. changes code, and just need to refresh browser to see results)
  • Non-Ajax Ajax (i.e. program in a manner similar to the Swing API; GWT does incremental updates to the DOM)
  • Awesome productivity

GWT not for everyone but its sweet spots are:

  • Swing-like apps that run in a browser
  • Java developers who have used a desktop UI framework will be familiar with it

Client side code

You implement the UIs in pure Java

  • Albeit a limited subset of Java [to keep the compiler simple]
  • Select choices from java.lang and java.util

In Hosted mode, your code runs in the JVM

  • use your favourite Java debugger

In Web mode: JavaScript tuns in the browser

  • GWT compiles Java to JavaScript
  • Compiles different dialects for different browsers, so should work OK in all browsers…

Server-side code

  • Written in Java
  • All of Java available (i.e. not a subset, like on the client side)

Get started quickly

The tools to help you get started quickly with GWT are:

  • Project generator
  • Application generator
  • I18N generator
  • Test generator

David then went through a demo where he created a app using GWT in a few minutes
All the demos were written in Java – no JavaScript!

Audience Questions

Q: What makes GWT standout from other UI technologies such as JSF and Flex?
JSF is for more traditional apps and and uses JavaScript.
Flex has its own version of JavaScript called ActionScript, as well as a a markup language.
GWT is aimed at developers who have used libraries like Swing.

Q: How does GWT compare to Dojo?
Dojo involves writing JavaScript
GWT involves writing Java
So with GWT, you are avoiding the problems of different results on different browsers (the GWT compiler takes care of that)

Q: How to debug
The Java gets compiled into a mountain of JavaScript.
You can actually debug through the JavaScript AND the Java at the same time, i.e. side by side, to find out exactly where the problem is

Q: Security
there is no real security built into GWT, so security concerns that you may have with Ajax still exist with GWT.

My take-aways

The big selling point of GWT is that you don’t need to write JavaScript – just Java, and that you don’t need to worry about cross browser compatibility


Leave a Reply