Working on a new GWT application for a personal project

I have been using SmartGWT a lot for a customer's project so I have been generally digging into both the Google Web Toolkit (GWT) and the SmartGWT system that builds on top of GWT.

My personal project is a reimplementation of my Rails application for (very old placeholder page) in GWT. I plan on writing a few long blog articles about GWT and/or SmartGWT in the near future but for now I have learned a few things that are worth sharing:
  • Plan ahead on designing data models that essentially live on the client side, that support caching on the client side, and efficiently support asynchronous data fetches from the server. The view pages (written in Java, compiled to compact and efficient Javascript) must always make asynchronous calls to the local (in the browser) data model because it is unknown whether the local model has the data or must itself fetch asynchronously from the server.
  • Stop thinking about session data in the same way that you do in an old style web application: any class variables in your application are always available in the compiled client side code. The only reason to store session data on the server is security: remember that in principle someone could hack the Javascript code in their browser so for some operations the client needs to pass a security token (defined during login/authentication) to the server and the server must verify access privileges for an operation.
  • Developing in your IDE's debugger is a good idea. I use IntelliJ and there are separate panels for server side log views, warnings generated by the Javascript code on the client, and the debugger itself. Very useful!
  • Once you have designed your (mostly) client side data model and determined its interface to your server side datastore (which is the AppEngine datastore in my current project) try to get as much of the server side support written and debugged as you can before seriously starting to write the client side UI. The main reason for this is that if you are only editing client side Java code (that gets compiled to Javascript) you can edit, save changes, refresh your browser and immediately see the results. Whenever you need to modify server side code you must restart the application which really slows down development.
Writing a rich web application in GWT certainly takes a different mindset than simpler AJAX applications but it is worth the effort in some cases. For my current personal project, the original Rails implementation had great functionality but was not fluid enough to use continuously throughout my work day to track time and write work notes. Because this is for my own use and there is no deadline for finishing it is worth my time to get it just right, working on it an evening or two a week.

At the beginning of this year I was very interested in SproutCore for the same general developer use cases as GWT. SproutCore uses the same sort of asynchronous event handling style as GWT with a big difference that you write the client in Javascript instead of Java. This year my largest customer evaluated both SproutCore and GWT (and derivatives like SmartGWT and GWT-Ext). Since they are a Java shop they decided to use SmartGWT which gave me an incentive to dive more into GWT related technologies. As with most of you, my technical interests are sometimes (but not always!) driven by what people pay me to work on.


Popular posts from this blog

Ruby Sinatra web apps with background work threads

My Dad's work with Robert Oppenheimer and Edward Teller

Time and Attention Fragmentation in Our Digital Lives