Google Web Toolkit again

Google Web Toolkit 2.0 was released some months back. As I've said before, I think GWT or something like it is really the right way to write web apps. The optimized/compressed/inlined Javascript you want to be running in any nontrivial web app is so far from the readable and modular code that you want to actually be writing that it really demands an intermediate translation layer. This most recent release really just cements that fact.

For example, new in GWT 2.0 is code splitting, a feature that helps to reduce page load times. You define some split points in your app— points during execution where the client can make a round-trip to the server to fetch more code. GWT breaks off parts of your application that aren't needed when the app initially loads, and only downloads them when the app needs to cross the split point. Sure, you could compute, by hand, the transitive closure of all the components of your application that aren't past any split point, and shuffle your code around between files, and dread having to redo all that every time you do some refactoring. But you have better things to do.

It's true that Javascript engines are getting faster every week, so the value of highly optimizing your Javascript ahead of time may seem rather uncertain. But GWT also does things like automatically creating image sprites on your behalf, so your app can pull down all its images without the overhead of multiple HTTP requests. No Javascript engine can make excessive image requests fast. And in version 2.0, GWT does something similar for stylesheets. Again, all stuff you could do by hand— if you were highly disciplined, or a robot.

Further reading: More new features in GWT 2.0 and stuff slated for 2.1.

No comments:

Post a Comment