Nov 18, 2006

Google Web Toolkit for the Mac

Post por às em blog

Macs inside Google

Posted by: Kelly Norton, GWT Engineer – fonte:

I remember sitting in front of my Power Mac G5 reading about Google Web Toolkit in May of last year and thinking about how cool it was. It’s such a great idea for AJAX development: use a language with unequalled tool support to write your code and then compile it into compact, highly optimized JavaScript which automatically works around all manner of browser quirkiness. I was eager to try it but very disappointed to find that it was only available for Linux and Windows. So I bookmarked the site and decided to check back later.

In a strange turn of events, as I watched GWT develop, I somehow came to work for Google … on the GWT team, no less. So when I got the opportunity to participate in the recent addition of OS X support, I was thrilled. The previous versions of the toolkit had made debugging possible by hooking directly into the JavaScript engines of Internet Explorer and Firefox, which helps our Windows and Linux users. A few weeks back, we started down a similar route with Webkit/Safari, and today that version showed up on the GWT download page. So for all the other Mac folks who have been checking in on GWT hoping to find a Mac download, voila. And for those of you who have no earthly idea what I’m talking about, let me just give you a very quick intro.
What is Google Web Toolkit?
Ever wonder how killer applications like Gmail, Google Calendar, and JotSpot are built? It’s not enough to have a great idea; you need to know how each browser deals with JavaScript, CSS and HTML. You know, things like how element prototypes are shared across iframes on Internet Explorer and Firefox, but not Safari. Or that Opera’s scrollTop values often give you non-zero values even when there isn’t a scrollbar anywhere in sight. If you still have no earthly idea what I’m talking about, let me just assure you that there are many such things that make development of AJAX applications error-prone and just plain painful. And I haven’t even mentioned the pain of managing a large codebase using a language that gives you as much freedom as JavaScript does.

Instead, GWT takes a different tack: write your AJAX code in Java, leveraging concepts and patterns that have become very familiar to UI developers; develop using proven development environments that include good code completion and refactoring tools like Eclipse; debug your apps by running them in a real browser, using a solid debugger; then use a compiler to translate all that Java code to tiny, high-performance JavaScript that automatically works around most browser quirks without so much as a nod from the developer. And of course, make it possible to slip seamlessly into JavaScript when the need arises to do things we never even anticipated.

But there’s one more thing…

OK, you have to promise not to tell our Windows and Linux users, but we were able to slip a little something extra into the OS X version. One item that has been on our nice-to-have list for some time has been a quality DOM inspector to allow developers to take a look under the hood at the dynamically created tags you find in AJAX applications. On the other platforms, it’s still in the to-be-scheduled stage. But on OS X, right-clicking on the page you’re debugging reveals an interesting option: “Inspect Element.” Select that, and a window appears that should be familiar to you WebKit hackers. Yes, we enabled a feature that is part of WebKit but not turned on in Safari, which enables you to inspect DOM elements in the debuggable browser. But please, whatever you do, don’t tell the Windows or Linux folks about it.