2008/04/20

experiences with laszlo

(filed under programming)

After a long road of searching for the right app/plugin/tool to write a nice image gallery for this blog, which I am currently improving with tons of nice feats, I stumbled upon a programming framework called OpenLaszlo. It is actually the predecessor of the Adobe Flex framework.

If gallery flash/dhtml scripts were extremely difficult to obtain, I would have had a good reason to try out Laszlo. But I've allways longed to do something with flash. I tried sometimes, but was always very frustrated by the fact that flash does not seem to have source code and I never seem to possess a working flash editor.

Laszlo is a flash compiler (it can target to DHTML too). But it is also a framework which makes flash look more like html. Code is notated in xml files. Here is a sample XML file, to give an impression what it looks like:

<canvas>
  <button onclick="vw.toggleSize()" 
          text="Toggle Size" />
  
  <view id="vw" y="30" width="100" height="200" 
        bgcolor="blue" >
    <wrappinglayout spacing="10" xinset="5" yinset="5" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    
    <method name="toggleSize">
      var w = this.width;
      var h = this.height;
      this.setWidth(h);
      this.setHeight(w);
    </method>
  </view>
</canvas>

The reason why the code is xml is probably because Laszlo emphasizes declarative code and familiarity with the html/javascript combination. From a technical point of view, XML is a bad choice. The underlying language, javascript, requires you to use symbols like && and >. So this means that you often need CDATA sections to escape the javascript.

The Laszlo experience was enjoyable for me. I feel at home in html and I could instantly program something in Laszlo. But i did not manage to write my gallery in a single afternoon. The framework was too large and there were too many new elements to be that productive.

After one afternoon of laszlo I also have my fundamental doubts about flash and about laszlo. Layout management of flash and text rendering capabilities seem limited, so for rich sites I think plain old dhtml (enhanced with flash if special graphics are needed) is superior. (Perhaps I should try to use Laszlo that way... since it can also target dhtml) But the ajax framework of laszlo... well, it is 2008 now and there are 10 million ajax frameworks out there. And then there is the gui components question... new frameworks need rich gui components. Laszlo provides a gui library, and i was impressed by the clean xml needed to build a form. The look and feel are not very great: it looks ugly and grey in the default look. And the components are not as rich as for example swing components.
Also I suspect the performance of the framework is slower than a java applet would be. I don't have perfomance numbers but this is just my impression after one afternoon of usage.

In Laszlo, objects can have computed properties. For instance: The x coordinate of component 2 is the x coordinate of component 1 plus the width of component 1. Once you resize component 1,component 2 is automagically moved to the right.
JavaFX is clearly inspired by flex (and so by Laszlo), and also has this notion of computed properties. Both microsoft's Silverlight and JavaFX bring desktop gui libraries (microsoft WinForms, swing) to the web environment via a browser plugin.
The future of application building in your browser is ready for a next step. We will see wat it brings...

Meanwhile, I'll still have to make a gallery plugin for my blog.

Blog menu

Diversen

about

boeken

comicbookedit

comics

meditatie

nwsnewsnieuws

programming