Programming for the web is a bit like creating a Frankenstein monster. It is an amalgamation of different technologies that weren’t always created to work together. It reminds me of Marry Shelly’s shambling monstrosity in that it is composed of seemingly unrelated parts, crudely sewn together to create something that ends up working somehow.
All this will probably only happen in some dystopian future sometime after the English language is reengineered to be more efficient, consistent, and structured. That would be doubleplusgood, no?
Well enough philosophizing and on to some Google Web Toolkit goodness… I guess I could have titled this article “Google Web Toolkit: So you know some Java and you want to do some client-side web programming?”
I am not here to evangelize GWT, but rather to provide a Java developer’s initial opinion on and experience with the technology.
GWT has the advantage over Flash in that GWT just requires a web browser, no plug-ins needed. So far the apps I have created with GWT have worked great on all the mobile devices I tested them on. Flash does not work on iOS, and has mixed results on Android.
The SDK generates HTML and CSS pages for you but the HTML page requires a little configuring. Also to include any fancy formatting you have to modify the CSS page. For my calculator app I just changed a couple of titles and included a division to specify where to insert the app on the page with id="GWTCalcGoesHere". Google’s tutorial explains how to do all this.
On the negative side, I imagine that GWT can be likened to Dreamweaver (or a high level programming language) wherein the code produced is typically less compact and efficient than code written manually in the underlying technology. How significant the difference is, I don’t know. As with every programming technology there is a tradeoff between development time and cost vs. performance of the end product.
To get started with GWT I recommend visiting Google’s GWT page, installing the software, and doing their StockWatcher tutorial. You can skip the CSS steps if you are not interested in making it look pretty. It only took me a couple of hours to get GWT installed, read the introductions, and do the tutorial. Then it took a few more hours to get comfortable with the libraries, and write a couple of apps. Assuming you developed a fair proficiency with Java, learning GWT should be pretty easy.
Although the bulk of the libraries I have worked with are from GWT and not JRE, GWT does a good job of keeping things Java-like so it is easy to find the method names you are looking for. The syntax is the same and for the simple projects I worked on it pretty much feels like you are writing a Java app when working with GWT. The GWT online documentation even closely resembles the Oracle API documentation for Java, so there is no new learning curve. I do wish it included more code examples but this can be said for any programming language’s online documentation.
(Google, if you are reading this I would be happy to write billions of code snippets for you at a highly affordable price.)
So below is the link to the simple calculator application and source code I wrote using the GWT plug-in for Eclipse: