Google Web Toolkit Applications is the latest book in the GWT library. When I first heard about the book, I knew I needed to buy it. The author, Ryan Dewsbury is well known in the GWT community as the creator of GPokr and KDice, the most popular GWT applications up and running today. I was very interested in learning what Ryan had to say about building practical GWT Applications.
The book is clearly aimed towards beginning and intermediate GWT developers, but I’m sure expert users will be able to learn some new tricks as well. The book is divided into two sections. The first five chapters provide an overview of GWT concepts and features. The last five chapters step through the process of building five different GWT applications: a Google Desktop clone, a Multi-View search application, a Blog Editor, an Instant message client/server and a Database Editor. All of the applications are designed using a model-view-controller architecture and useful patterns are highlighted. Ryan then walks through the construction of each application, illustrating relevant parts with code and diagrams. Except for some of the latter parts of the book, I like the fact that most of the code snippets are concise and easy to understand. The applications can be seen in action on Ryan’s website at http://www.gwtapps.com.
Chapter 1 gives a brief overview of Ajax, current web technologies and where GWT fits in. There’s also a quick tutorial on building a GWT Hangman game, and the chapter ends with an overview of the various GWT packages.
Chapter 2 highlights the GWT user interface package. Each of the various GWT widgets and panels are explained in some detail. The rest of the chapter goes over the GWT Event interfaces and how to bind the widgets together.
Chapter 3 discusses how to use GWT to interact with a server. First, we learn how to use GWT’s RequestBuilder to make asynchronous calls. Then, the chapter describes how XML and JSON are used as a mechanism for passing data to and from the server. We also get our first exposure to the Same Origin Policy and learn a few techniques which enable us to integrate third party services into our GWT apps. The chapter concludes by describing the GWT-RPC mechanism.
Chapter 4 describes the process of first installing GWT and then setting up and working with the Eclipse environment to start writing GWT applications. There is a walkthrough of using the Unit Test framework to test the Multi-Search application (described in Chapter 7). There’s also a brief discussion on benchmarking and working with GWT modules. Finally the chapter ends by discussing how to deploy applications in various environments.
Chapter 5 talks about a variety of miscellaneous topics. These include:
- Back button support
- Using CSS
- Building custom widgets
- Using JSNI
- Providing Cross-Browser support
- Code Generation
- Improving Performance
Chapter 7 features a Multi-Search application that aggregates the results from various search engines. The chapter gives us a more in depth discussion of using JSON as a data format and the Same Origin policy. Then the chapter concludes by showing how to integrate with various search APIs like Yahoo! search, Google Base, Flickr and Amazon Search using these techniques.
Chapter 8 shows how to build a Blog Editor application that can integrate with an existing Blogger account. The chapter describes how to interact with more complex webservices by creating a HTTP Proxy Servlet, which is another method for bypassing the Same Origin Policy. With that in place, the rest of the chapter talks about how to integrate with the Blogger API using the GData protocol.
Chapter 9 goes through the design and implementation of a simple Instant Messenger application. After an explanation of the client portion of the app, we next get a look at the various techniques for creating event based protocols over HTTP. There’s a discussion of the hanging RPC call method, but we also learn about more scalable techniques using technologies like Comet (with Tomcat) and Continuations (with Jetty).
Chapter 10 shows how to create an Ajax style Database Editor. The first part of the chapter gives a detailed look at implementing the Database Editor views. Next we see how to integrate with a backend database using three different server integration methods. The first is with a PHP server using an Action based API. The second approach uses REST to talk to a Rails based app and the third method utilizes the GWT-RPC mechanism. There is also an extensive section on writing a GWT code generator to serialize/deserialize JSON and XML.
Overall, I think Google Web Toolkit Applications is an excellent book. It is easy to read and does a really good job covering all the major GWT topics and more. The applications demonstrate software development best practices and cover a variety of interesting techniques. The only negative about this book is that at the time of this review, not all of the source code for the applications is available, although it looks like Ryan will have them all up soon. The book has its own discussion forum and Ryan is active in answering questions. If you are really serious about doing GWT development, then you’ll definitely need to add Google Web Toolkit Applications to your reading list.
Buy the book at Amazon