Hello Dan,

  Thanks for these nice ideas, maybe a good thing would be to write
  some kind of guide 'how to develop applications in Laszlo'? Among
  the items to cover
   - model-view-controller pattern and it implementation
   - working with dialogs
   - organizing your code

 ... and much more I think. This can help people with little
 experience in asynchronous applications & strong traditional
 background work more efficiently with Laszlo...

DS> Asynchronous calls do force you to think about state a lot more than 
DS> you'd like to. Using Henry Minsky's closure-as-delegate trick, I've been
DS> writing a lot of code like this lately:

DS>          <method name="addSymbol" event="onclick">
DS>              var sclosure =
DS>              {
DS>                ui: classroot,
DS>                f: function( result ) {
DS>                     ui.displaySymbol( result );
DS>                   }
DS>              };

DS>              var eclosure =
DS>              {
DS>                ui: classroot,
DS>                f: function () {
DS>                     ui.displayError( 'Could not add symbol.' );
DS>                   }
DS>              };

DS>              var request =
DS>              {
DS>                succ: new LzDelegate( sclosure, 'f' ),
DS>                err: new LzDelegate( eclosure, 'f' ),
DS>              };

DS>              classroot.onaddsymbol.sendEvent( request );
DS>          </method>

DS> This splits the burden of handling state between the UI and the 
DS> controller that responds to UI events. I'm not sure I've struck the 
DS> right balance in my current project. I'm going to keep tinkering.

DS> The short answer: transmitting little bits of state via objects is a 
DS> nice way around some of the problems that arise in asynchronous 
DS> applications. I'll post more once I've found a cleaner solution.

DS> Dan Stowell
DS> Software Engineer
DS> Laszlo Studios



-- 
Best regards,
 Michael                            mailto:[EMAIL PROTECTED]

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to