Book review: Google Web Toolkit Solutions

Today I have a special treat for Dev Connection readers: a book review by a very talented colleague of mine, Adam Houghton. Adam is a professional Java programmer who recently started using the Google Web Toolkit for internal demos. When Addison-Wesley sent me a preview copy of their newest book on the subject, I immediately thought of Adam and asked him to review it. The book is available for purchase now as a Safari "Rough Cut", with the final paper version due in October 2007.

Today I have a special treat for Dev Connection readers: a book review by a very talented colleague of mine, Adam Houghton. Adam is a professional Java programmer who recently started using the Google Web Toolkit for internal demos. When Addison-Wesley sent me a preview copy of their newest book on the subject, I immediately thought of Adam and asked him to review it. The book is available for purchase now as a Safari "Rough Cut", with the final paper version due in October 2007. --Ed

I’m not a very good tennis player. Yet when I signed up for tennis lessons a few months ago, for some reason I checked “Intermediate” skill level. Not Beginner or even Advanced Beginner - no, I signed up for Intermediate. So when everyone in class focused on speeding up their top spin or disguising their back spin, I’d be happy just to get the ball over the net. I settled into my role as a ball feeder to the other students, who really were Intermediate.

Which brings us to Google Web Toolkit Solutions by David Geary & Rob Gordon. This upcoming book is written for an Intermediate audience--developers who have (at least) installed the Google Web Toolkit (GWT), created an ajax-y app, and debugged it via Eclipse. There are great resources for Beginner GWT and Advanced Beginner GWT, such as Google's online developer guide or Ed's excellent e-book and gwtPowered web site. If you are just picking up GWT for the first time, I highly recommend you start there. But when you're ready to add a little spin to your ball, GWT Solutions is a good next step.

Right from the start, this book helps lay the framework for creating production-level applications. The first chapter covers two important topics: browser history and internationalization (i18n). Neither is necessary for creating Hello World, but definitely make a difference in real world applications. Support for browser history has always been tricky in web applications, especially in the Ajax world (“please use my special previous arrow, not the big one you click everywhere else!!!”). Luckily, GWT provides integration with browser history via HistoryListeners. It’s pretty painless to implement, but definitely easiest if you build it into your app at the beginning. Ditto with i18n--no developer looks forward to removing hard-coded strings from 20,000 lines of code. This book makes you eat your broccoli from the start: a couple extra minutes of work that you’ll be thankful for weeks later when the boss decides it’s time to translate the application into Dutch.

In addition to covering the important plumbing, Google Web Toolkit Solutions shows off a few of the framework’s flashy possibilities. The fun really starts in Chapters 4 and 5, with examples of dragging viewports, iPhone-like gestures, and Yahoo Map mashups (and this is all before the halfway point of the book). These implementations are chock full of useful GWT tips, and the authors provide source code for using or extending them. But they also help illustrate one of the authors’ main themes: that GWT is a feature-rich, world-class environment for developing GUIs. The fact that they could reproduce iPhone gestures with cross-browser compatibility in just a couple days of coding really shows the power of the framework. The authors encourage developers to think beyond traditional web frameworks like Struts and Ruby on Rails, and to treat GWT as a competitor (successor?) to Swing & Eclipse’s Rich Client Platform.

The areas of the book I find most helpful are the instructions for real-world deployment and integration of Google Web Toolkit applications. It’s easy enough to launch GWT apps from Eclipse in hosted mode, but your local playpen is probably not an ideal server for thousands of users. The last three chapters cover the nuts and bolts of deploying GWT apps to external servers and integrating with ORM frameworks like Hibernate. And as much fun as it would be to rewrite everything in GWT, upper management usually isn’t keen to throw away perfectly fine code that took years to develop. GWT Solutions shows how to integrate with Struts-based legacy applications and mix-in external Javascript libraries like Script.aculo.us. (Once your GWT component is sitting on a sidebar of the company web page, it can begin its quest for site-wide domination.)

The format of the book is long code examples with follow-up discussion and tips scattered throughout. This makes for interesting reading and helped me discover quite a few new techniques. The only downside is that the discussion of some features is spread out over different examples and chapters, which made it easy to forget where I found something and difficult to focus in on help with a specific feature. The examples are written using version 1.3.3 of GWT, but the authors note areas where the upcoming 1.4 version fixes bugs and improves on functionality.

Overall, I’d recommend Google Web Toolkit Solutions. The extensive examples and tips go a long way in progressing GWT skills from Intermediate to Advanced.

Bio Adam Houghton’s high tech career began at age 12, running a multi-line bulletin board system from the family living room. He later enjoyed riding the dot-com wave as a server-side Java developer. Adam’s software is still chugging away at a diverse range of clients, from Radio City Music Hall to the Texas State Prison System. After moving to Durham, North Carolina, he settled down into the stable world of business software working on OLAP accounting systems and high performance computing.

Adam is a Senior Software Developer at SAS and specializes in all things Java. Lately, he’s been caught lurking in Cocoa, .NET, and Ajax, hoping to atone for years of avoiding GUIs. Adam finds the Google Web Toolkit to be a perfect fit, since it lets him program snazzy web sites without ever leaving Eclipse.