OpenLaszlo vs. GWT

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.

OpenLaszlo seems like a confusing mix of JavaScript and XML. I never got clear on just why there was so much XML. It seemed like a classic case of misusing XML because it’s there. I suspect JavaScript alone wasn’t strongly typed enough, and the developers didn’t want to bother writing a parser for a custom format. GWT, by contrast, is pure Java so it’s a lot cleaner. I like XML; I like Java; and if I’ve taken enough drugs, sometimes I even like JavaScript. However mixing them together in the same program just seems like a really bad idea. It’s like constantly switching from English to Chinese and back again in the same sentences.

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.

I’m also a bit concerned by the sheer opacity of the JavaScript code that GWT generates. It looks like it was passed through one of the 1980s era C obfuscators that allowed you to ship Unix source without actually revealing anything. The purpose here is not obfuscation. It’s optimization. However it does make hacking, debugging, and understanding much harder. I guess the response here is that we should trust the compiler. After all, it’s not as if we do all that much assembly level debugging these days anyway. However given the wide variation in browser support I’m not sure either the compiler or the runtime are worthy of that level of trust just yet.

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.

12 Responses to “OpenLaszlo vs. GWT”

  1. Flex Is Open on iface thoughts Says:

    […] Adobe has open sourced Flex (press release). Good news for developers, and eventually it will be good for Adobe too. Adobe had already contributed to Tamarin and now it has make its name bolder in good books of a lot of developers. Competition wise, this is a big move, take guard OpenLaszlo! […]

  2. Ugo Cei Says:

    I think with GWT you have the option of generating either “clean” Javascript for debugging or compressed Javascript for obfuscation or efficiency when in production.

  3. Scott Ellsworth Says:

    Ugo is correct. There is a detailed mode appropriate for use with Venkman, and a squirrelly mode (ok, obfuscated) designed to be compressed down. Each version of GWT has made the obfuscated code more terse and more human-unreadable, so while developing, I usually leave it set to detailed.

  4. Pete Kirkham Says:

    During XTech 2006, whilst apologising for the XML mark-up used to describe UI widgets, the member of the OpenLaszlo team giving the presentation indicated it was due to the person designing it having only experience of MFC as a window tool kit. So there’s at least three things wrong with it for a start – don’t release code you feel a need to apologise for, accept collective responsibility, practice peer review before committing.

  5. Elliot Winard Says:

    GWT looks like a great way for Java developers to develop AJAX apps using tools they’re already familiar with. I hope that Robb and I didn’t come off as anti-GWT and don’t think that Joel Webber was very anti-OpenLaszlo.

    It’s a matter of preference and different tools are better for doing different tasks. Although it’s certainly possible, I wouldn’t use Java to build something that can be done more easily with 2 lines sh script. I also wouldn’t write a shell script to handle my company’s business logic. I find it much more fun and faster to develop web apps using OpenLaszlo’s LZX than working with lower-level languages like Java. Perhaps I’ve “taken enough drugs”? 😛

    Regarding the RESTian nature of Laszlo apps – Admitedly, bookmarking is a tricky thing to do in a non page-based AJAX applications. Because most Laszlo apps are not page-based, it’s tough to generalize a solution. The Laszlo apps that I build consume REST services and a few of them are deep-linkable. Maybe I’ll post a bit of sample code so it’s easier to make more RESTafarian web apps.

    Laszlo’s been open source for over 2 years and can now target different runtimes – currently DHTML/AJAX and the Flash player. JavaME compiler is in progress. Adobe made a smart move by open-sourcing Flex.

    Robb showed off our fancy new stuff first and probably should have started with a HelloWorld! app. Here’s one — <canvas><text>Hello World!</text></canvas>

  6. raju Says:

    For Java people the GWT is pretty attractive: familiar tools and languages! That’s a big advantage. But don’t forget: OpenLaszlo has been one of the pioneers for building rich Internet applications and has come up with some very impressive applications, including Laszlo Mail and the newly realesed Webtop.

    Here’s what Gartner had to say about Laszlo, which was listes as one of the “Cool Vendors in Application Development 2007”:

    “OpenLaszlo is cool because it is the only RIA platform in which developers can define the user
    interface in a declarative (nonprocedural) manner and target different runtime environments,
    including Ajax, Flash and Java 2 Platform, Micro Edition (Java for mobile devices). Although
    many vendors are using a declarative XML representation for the interface (including Adobe,
    Microsoft and Nexaweb), no other vendor enables this XML to be rendered to as many different
    runtimes.”

    The XML + EcmaScript approach is a very modern approach of interface development. Many of the best Ajax Toolkits followed the approach of OpenLaszlo and came up with similar concepts, not to forget Adobe and Microsoft here. I’ve been building Laszlo applications very effectively with OpenLaszlo and never ran into any problems. I don’t think Java is the one language we should use for everything connected to programming. There a better and more modern concepts evolving, but of course everyone is free to chose.

  7. Ryan Stewart Says:

    Hey Elliotte, thanks for taking the time to do the writeup. Great to see what people think of GWT vs. Laszlo from an objective viewpoint.

  8. All in a days work… Says:

    […] OpenLaszlo vs. GWT – On Laszlo vs Flex, their first answer was, “Flex isn’t open source”&#8230… I like XML; I like Java; and if I’ve taken enough drugs, sometimes I even like JavaScript. However mixing them together in the same program just seems like a really bad idea. Laszlo: a way to embed a full-blown thick-client GUI into a browser using Flas (tags: OpenLaszlo GWT) […]

  9. Weerasak.com » Article: OpenLaszlo vs. GWT Says:

    […] OpenLaszlo vs. GWT by Elliotte Rusty Harold 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. […]

  10. Marco Lettere Says:

    We’re trying to build a compiler that auto-generates form based web applications according to specific models. The power of having a declarative language (XML) that wraps up all the GUI structuring code in a naturally recursive way is very helpful. We thought about trying the GWT way but generating Java code is way more complex than generating XML code. Thus we tried to integrate GWT with XForms and though this solution could be employed to obtain results similar to Laszlo (at least in terms of forms functionality) it is clearly more complex to implement and it seems very difficult to even approach the graphical beauty of a laszlo application.
    My two cents: GWT is cool, XForms is cool, Laszlo is cool. Having that much choices is even cooler…
    M.

  11. Lluis Martinez Says:

    [quote]
    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.
    [/quote]

    As far as I know, the Laszlo engine works in the server side by compiling the UI definition XML into Flash or DHTML/JavaScript objects. To run an applet you need the whole JVM in the client. With Laszlo (and Flex) the only VM required is Flash player, a de facto standard.

    I agree with you about the JS generated by GWT, it looks like garbage to me and it’s a negative point for GWT. On the other hand, I prefer to define the UI in Swing-style instead of XML. But for tastes there are colors 🙂

  12. Kevin Says:

    Hi,

    Correction: OpenLaszlo’s primary communication system is RESTful. You usually send an HTTP POST from an OpenLaszlo dataset to fetch XML from a URL. I admit this is not obvious from the beginner OpenLaszlo tutorials. However, this is always a pull from the OpenLaszlo application and never a push to it.

    Kevin