Last night I went to the New York City Java User’s Group to hear about AJAX toolkits, more specifically OpenLaszlo and GWT, both presented by their respective developers. It was an excellent idea to do these two talks on the same night since it made it really easy to compare and contrast the two approaches.
I came away with a definite preference for GWT, though it’s hard to tell if that’s because of the toolkits themselves or just because of my preference for the speakers. The OpenLaszlo presentation was classic PowerPoint bullets read off the screen, along with some reasonably cool demos. The GWT presentation was done completely in Eclipse with smaller, less impressive demos. The first GWT sample code was Hello World, as it should be, so I really felt like I could see how to get this working and understand how to use it. The OpenLaszlo sample code was too complex to follow just by glancing at the screen, though likely it did something more.
More importantly, OpenLaszlo seemed pretty fundamentally unRESTful. There were no URLs anywhere to be seen, and it didn’t look like the Back button, bookmarking, or linking would work. The extent to which you could write a non-Laszlo program to communicate with a Laszlo service was unclear. Ultimately what Laszlo really looked like was a way to embed a full-blown thick-client GUI into a web browser using Flash or DHTML. It’s an impressive trick, but it’s not really what I want to do. I’ve already got Java for that. AJAX and web applications are about moving data around between systems inside a standard UI, not about inventing new UIs. GWT seemed much less ambitious, or at least the demos of apps written in GWT shown last night were less snazzy than the demos of OpenLaszlo apps. However, they were a lot closer to the sort of web applications I actually do want to write.
One small point in OpenLaszlo’s favor: they understand paging, which all too few developers do. With GWT, it’s a third party add-on. The basic problem is this: you have 100,000 records to show to a client, and it takes forever to send and display them. What do you do?
This is a classic problem that predates the Web, and the answer is still the same: you don’t. It’s not as if anyone is going to look at all 100,000 records at once anyway. Instead you send the first 10 or so, the current 10, the next 10, the previous 10, and the last 10. That is, you send the records the user is going to look at now, as well as the records the user is most likely to look at next. Then as the user scrolls through the result set, you send more data as necessary but never more than a few hundred records at a time at most.
Bottom line though: the next time I need to do some heavy lifting in AJAX I’m going to turn to GWT. It fits the way I think, and it uses familiar tools and languages. Doubtless as I dig deeper into it, I will find flaws. I always do. However it seems like a really nice 80/20 solution with the right hooks to escape out for a 99/1 system. OpenLaszlo just leaves me confused. I’m not saying it isn’t the better solution, but it certainly feels like the one with the much steeper learning curve.
P.S. The OpenLaszlo folks were asked what the difference was between their toolkit and Flex. The first answer was, “Flex isn’t open source” (or words to that effect). Then I wake up this morning and see this: Adobe to Open Source Flex.