OpenLaszlo asynchronous initialization mess

Google Buzz

Yes! Asynchronous frameworks are most of the time big messes on initialization. OpenLaszlo isn’t a exception. synchronization

Don’t get me wrong, I do love OpenLaszlo and the philosophy behind it. Writing a RIA application once and release it to several platforms, like Flash, Dhtml, SVG or any future (javaFx or silverlight… maybe?) one is just a great idea. The data binding and replication is also very well done, although the data elements and their methods can confuse you, regarding if you are dealing with a pointer or the structure, sometimes.
All in all, it’s one of the best platforms to build quick and fun RIAs with server connection and has the advantage regarding Flex, that you are not limited to Flash.

The down side is its script performance. It’s all very slow comparing with actionscript. I really don’t understand why as it should be translated to action script on compile. But usually, complex scripting is very slow. Also, there aren’t as many libs and architecture frameworks as there is for actionscript and flex.

Well, pros and cons are not the propose of this post, but the initialization mess.

When you are building a somehow complex application and have several interfaces, and interactions between them, you usually have a lot of interdependencies.

Taking the hypotheses that you do a lot of things in the “OnInit” event to set all up regarding scripting behavior, your oninit (or onmouseaction, or another event) method will probably be “dependent” of another element of object. Unfortunately, other object may not be initialized or constructed yet, so, may of their attributes many not have values.

The problem is: you have always to be sure that what you are dealing with is already created and working.

The solution: set the initialization stage for “later”.

Dead Lock

The real problem are: the dead lock you get because in some application, where you “need” to have a certain behavior from the begin and it is dependent from another initial behavior from another class. Basically a synchronization problem. Of course you can work around all this, you can set (global or class) attributes to synchronize or be as a semaphore or you can use ${something} script type dependencies that will slow down your up.
hmm.. I have to explore the State components as they might be another better solution.

The point is: you can get all you want done, but it requires work that you shouldn’t have to do and it’s a mess.

An advice: on views that you set the resource source ondata or oninit, be sure that all mouse events only work after onload. I can’t tell you how many times this caused be problems.



 
Was it any good?

Add to Technorati Favorites

AddThis Social Bookmark Button

Add 
to Mixx!