Monday, July 23rd, 2007
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:
- 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.
- 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.
- 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.
- 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).
- 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