--------------------------------------
There is little question that the Web browser has become the platform for most software applications. The rich Web applications of today push the envelope of Web browser standards (such as HTML, JavaScript, and CSS). Consequently, software developers are finding it necessary to become browser experts. Fortunately, new technologies are being created to help developers bring rich Web apps to market more efficiently. One such technology is the Google Web Toolkit (GWT).
Evolution in Web Application Development
Web development is moving away from the request/response paradigm of older generation applications. In older apps, the application server generated the “View” in the Model-View-Controller pattern. This led to lots of chattiness between client and server, and consequently poorly performing applications and frustrating user experiences. This has been helped with the advent and use of AJAX, which reduces full-page reloading and promotes richer, thicker clients with less control of the View on the server. Many modern Web apps are stateful clients comprised of HTML, JavaScript, CSS, and AJAX calls to a stateless server which performs CRUD (create, read, update, and delete) operations on the database. GWT is a perfect candidate for developing these types of apps.
Hello GWT
GWT is first and foremost a cross-compiler, taking your Java code and compiling it into compact, optimized, and browser-specific JavaScript. One might think of GWT like a traditional compiler that takes a high-level language and compiles it into binary code that runs on the platform. For GWT, the high-level language is Java, the binary code is JavaScript, and the platform is the Web browser.
To create the user interface, you code in a Java swing-like fashion, with panels and other widgets and event listeners. The JavaScript, HTML, and CSS artifacts can be deployed on any Web server. Developing and debugging a GWT app doesn’t require a JavaScript ninja or an expert in HTML/CSS, though these skills won’t hurt. For those who need to write their own JavaScript or use libraries like Prototype, Dojo, or jQuery, then GWT provides a JavaScript Native Interface (JSNI).
GWT is not so much a framework as it is a toolkit for developing rich Web applications. GWT doesn’t impose the complex lifecycles you find in frameworks like Struts or JSF. GWT is not a widget library, though you can use the provided widget library. You can also use 3rd party libraries, like Ext GWT (Ext-JS), Tatami (Dojo), or SmartGWT. Some wrap existing JavaScript libraries using JSNI, and others are written in Java and compiled to JavaScript.
Because you write Java code with GWT, you can use your favorite Java IDE to debug or refactor. Java coding allows strong typing, object-oriented design patterns and abstractions, and third-party Java libraries. Your code and imported libraries will be compiled to JavaScript and run in the browser. Before you worry about initial download times, note that the GWT compiler will aggressively prune the code down to what is really needed.
Even though the browser side of the application is written in Java, it doesn’t need to talk to a Java application server. In fact, you don’t need to talk to a server at all; you can create offline/detached applications. A GWT app can talk to RESTful or other HTTP-based services, and use JSON, XML, or other message serialization. Developers can also use the GWT-RPC mechanism for browser-to-server communication which requires a Java app server.
Impact at the Church
GWT is provisionally approved for use at the Church and it complements technologies already on the menu. It is currently being used for one project and the engineering teams are considering it for several others. It can be easily adopted because our many Java developers can learn it quickly. Production/support teams don’t have to retool as GWT-based apps are rolled out. For those concerned about support when adopting GWT, Google appears very committed to it. In fact, at Google I/O 2009, their main tech conference, GWT was proclaimed strategic to Google’s offerings.
Future Developments
Improvements in JavaScript performance and support for HTML 5.0 are making it easier to develop rich and responsive apps running in the browser. This can be done without requiring users to download/upgrade proprietary browser plug-ins, like Flex, Silverlite, and JavaFX. Improvements in browsers will only enhance GWT’s ability to create richer user experiences.
GWT is certainly not the be-all and end-all of tools that will help create rich Web apps. On the other hand, Google has done something very compelling that will help developers be more efficient today.
Additional Resources
- Google Web Toolkit home - http://code.google.com/webtoolkit/
- Sessions on GWT at Google I/O - http://code.google.com/events/io/sessions.html#gwt
- Gallery of GWT Apps - http://gwtgallery.appspot.com/
- Wikipedia article on GWT - http://en.wikipedia.org/wiki/Google_Web_Toolkit