Monday, July 23rd, 2007

Review of GWT in Action

Category: Book Reviews, GWT

Any time a hot technology comes along — and GWT is certainly white-hot — publishers compete in a mad scramble to get the first books out the door. Often quality suffers. I am happy to report that GWT in Action is a strong effort that doesn’t seem to suffer from this quality problem. (That isn’t to say there aren’t any errors and omissions in the book, just no obvious ones that I’ve found in my reading of it.) Instead, the book offers a solid, learn-by-example approach to understanding the Google Web Toolkit.

This learn-by-example approach, tied together through the development of a dashboard application over the course of several chapters, strikes, I think, the right balance for a broad audience. This is not the reference “bible” for GWT, though it does contain more reference material in one place than any other source so far, so you’ll have to wait for that sort of reference work. But for anyone wanting to get a jump start on GWT, start developing applications, and understand what all the fuss is about, I heartily recommend this book.

The book is organized into 17 chapters, split into four parts: Getting started; Building user interfaces; Advanced techniques; Completing the understanding. So, on to what’s in the book, chapter by chapter:

  1. Introduces you to the central ideas of GWT: compiling Java in JavaScript and debugging in Java. Does a good job of touching on most of the features of GWT — widgets, internationalization, JRE emulation library, RPC, browser history, etc. — and illustrating them with code samples. Finishes off with a complete client-side (no RPC) tic-tac-toe example app.
  2. Things slow down a bit here, as the authors delve into the organization of a GWT project and the details of the GWT development cycle. I’m torn on whether this chapter could have been illustrated more clearly with an example application, rather than just by enumerating the steps and components and diagrammatically illustrating the work-flow. The information that’s here is solid and correct, but the approach seems to conflict with the learn-by-example used so well in the rest of the book.
  3. Begins the process of developing the Dashboard application — essentially a web desktop or portal with draggable component apps. It makes concrete the more abstract development life cycle notions of the previous chapter. At the end of this chapter you have a skeleton application with menus,
    a trash icon and some basic CSS styling, and you will have run it (and debugged in Eclipse for hosted mode) in
    both hosted and web mode. This chapter attempts to instill good behavior by adding i18n (“internationalization” with the 18 letters between the “i” and the “n” omitted) at the very beginning. That way if you leave it our of your apps, you have no one to blame but yourself. You’ll also have a good understanding of the major project files: the HTML file, the EntryPoint, and the module XML file.
  4. The start of Part 2 of the book which introduces GWT “widgets” — in short, GUI components. Dissects their dual nature as Java objects and DOM elements and introduces the basic GWT widget set. Covers several common GUI and Web concepts, such as DOM events, focus, keypresses, etc. Shows two different ways of developing custom widgets — one from scratch by manipulating the DOM and the other, the PNGImage to support transparent PNG’s in IE6, by extending an existing widget class. Finishes off by building the first two custom widgets for the dashboard application, the TwoComponentMenuItem and the ToggleMenuItem. The full details of building the PNGImage class, using GWT’s technique of deferred binding to handle browser differences, is split between here and Chapter 15. Small nit: I think the concept is important enough to have merited a section of its own in this chapter or the other.
  5. Presents the basic concepts of GWT panels — the containers that hold widgets and other panels. If you know Swing, this will all seem pretty familiar, in particular DeckPanel, FlowPanel and DockPanel should seem familiar. (It is interesting to note that in GWT, layout is specified through inheritance (Is A FlowPanel), while in Swing it is a pluggable behavior (layout manager).) Of course, remember to pay no attention to the HTML Table behind the curtain, at least not if you want your code to keep working when the implementation changes. The chapter finishes off by extending DialogBox to a DashboardPanel that can be used and manipulated in a multi-window interface (or MDI).
  6. Focuses on Events, both Browser/DOM events and it’s custom Widget events. This is a long chapter (over 50 pages) and covers lots of territory. If you already know your way around Java and the various kinds of Listeners, you’ve won a quarter of the battle, but you may want to brush up on the browser side of the equations a little bit before reading it (see here, here and here). Not that the chapter doesn’t do a good job of presenting the material, but sometimes you need to have a firm grasp of one topic before combining it with another, and I think this is definitely one of those times. The chapter finishes off by implementing drag-and-drop for the Dashboard app, combining the widget knowledge from the previous two chapters with your new understanding of events.


Posted by Dietrich Kappe at 7:41 am

3.6 rating from 43 votes


Comments feed TrackBack URI

What the hell is GWT? …stupid acronyms…

Ah yes,

Was saying Google Web Toolkit really so hard? Yeesh.

Comment by desmus — July 23, 2007

This book was a long and meandering mishmash. It puts you to sleep, and i not one of the manning best. I was already murky on GWT and this book just pushed me over the edge. There was too little explanation of anything and too much mention of the GWT magic, not to mention the endless fawning over how cool it is. Check out the review done by Javaranch to see what I mean.

Comment by erasmus — July 23, 2007

I am working on a GWT application and am not finding this book all that useful in finding solutions to the problems I am encountering. I would recommend sticking to the samples that come with the package download, and buy this book if you have a lot of time or you are not familiar with Swing style programming. If you don’t know what GWT means probably don’t buy this book.

Comment by Karl — July 25, 2007

Leave a comment

You must be logged in to post a comment.