Technolog

I know, I know. You can’t move at the minute for people talking about Google. But the tedious Street View controversy isn’t what’s got me going this month. It’s more interesting than that.

Technolog

First, there’s the news Google is basically plugging JavaScript into the DirectX engine. And what’s the main problem with JavaScript apps, aside from basic execution speed? It’s the interface. Web apps just don’t flow in the same way as real native desktop apps. We’ll come back to that shortly.

Second is a fabulous tool I discovered a couple of weeks ago that I’ve been unable to stop tinkering with ever since. Its slightly cryptic name is the Google Web Toolkit – shortened by those ever-keen-to-reduce-keystrokes hacker types to GWT. You’ll find it at http://code.google.com/gwt.

The whole of GWT is suffused with the Google philosophy of not making simple things deliberately complicated. For starters, to make it go you just need to download two zip packages: the GWT code itself and a copy of Eclipse, the open-source development environment. Unzip the archives into a convenient folder on your hard disk and run them from there.

GWT does something I find faintly magical. You write a Java application more or less as normal in Eclipse. That means you’re cosseted by a powerful development platform that, for instance, not only tells you when a line of code contains errors, but will automatically fix them if you ask it to.

Now, I’m possibly the world’s greatest Java fan. It’s elegant and immensely robust and its uptake as the standard language in university teaching is no coincidence. But what I don’t like is the JavaScript language. JavaScript bears almost no relation to Java beyond having roughly similar syntax and that similar-sounding name. Java was invented by Sun; JavaScript was invented by Netscape for the Navigator browser, and the canny developers phoned up Sun and asked to call it JavaScript to give it some gravitas.

JavaScript is a hideous, weakly typed, interpreted language, its only saving grace being it’s a language spoken by web browsers. That means you can directly embed JavaScript into HTML web pages, thus producing those terribly trendy new things known as web applications. It’s horrible trying to develop in JavaScript for about a million different reasons, but if you want to write a modern Ajax application that will run in a browser, you have to.

Until now. Because, once you’ve written your Java application in Eclipse, and assuming you’ve paid attention to a few relatively minor limitations, you can ask the Eclipse GWT plug-in to translate your Java program into JavaScript, convert your GUI elements into dynamic Ajax controls, automatically fire up a local web server and run it in a browser. Just like that. It’s insanely easy. GWT even detects which browser the app is running in and takes care of minor differences, so it will look the same no matter what the platform. That’s something you’d have to do manually if writing directly in JavaScript, and is the kind of drudge that drains the fun out of web development.

And remember the bit about not needing to install Eclipse and GWT? That’s solved my biggest development annoyance. Until now, the complicated installation of IDEs such as Visual Studio or Sun’s NetBeans IDE has meant being tied to developing on one PC that you’ve spent ages setting up.

Pah. So last decade. All you need do now is add your Eclipse folder to your Live Mesh (www.mesh.com), pop a few files into a separate folder in a common location on the C drive so your workspace stays consistent, then sync that too and hey presto! You can carry on developing your application on any machine with a web connection just by syncing two folders. It’s literally a five-minute job and you can be editing the same code you were editing at home last night, in the same IDE, on any computer that happens to be lying around.

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.