A limited-java programers journey into Google Web Toolkit
I’ve always liked working with widgets as they can be quick and easy or both challenging and fun. I’ve built widgets in many scripting languages as well: HTML; JavaScript; PHP plug-ins for WordPress. I’ve also built widgets using the Yahoo widget frame work but to keep an open mind I decided to look into Google Web Toolkit (GWT) frame work as well. This article and subsequent related articles describe my limited-java experience while learning and using GWT.
The Google Web Toolkit as described by Google is a Java development frame work that allows you to develop widgets in Java which is then compiled into JavaScript. GWT supports the HTTPRequest object, XML Document, and even Remote Procedure Calls. GWT is touted as being cross browser compatible without the need to detect.
Google Web Toolkit can be used with any editor but Eclipse is recommended. When creating a GWT widget application there are arguments to signify to build the Eclipse project file for direct import into Eclipse which is quite handy. Although you can certainly test your app in both hosted and web mode from the Command Line Interface you can also use Eclipse to test both modes as well, again another handy feature.
So why would I, having many years of deeply working with JavaScript, use GWT? My Java experience is limited and this would be a great way for me to get back into it. Certainly I’m not saying that GWT is Java and as a matter of fact you can only use a limited amount of true Java and below version 5.0. The GWT classes are however Java so there is the trade off.
The other neat feature is the junit testing which I have not gotten into yet. Of course I unit test my JavaScript using jsUnit but even that can be tricky and really sticky when doing HTTPRequest tests. Not to mention the JavaScript test are nothing more than bloatware when moving the js files to production. Keeping in mind that I use JavaScript classes and not free functions so my unit tests must be internal to the object.
No more alert(); type debugs either. Using System.out.println() within Eclipse you can see the output within the console. I haven’t gotten to the point of using the debugger yet. Should be interesting.
Subscribe