@LeftRight: about faults.. the first idea on my mind was simply
translating fault events into standard Error throwing, so you can use
normal try/catch logic to handle failed sequences instead of
explicitly analyzing the result of each "synchronized" invocation.

@Robert: exactly, I don't really care about improving response time,
I'd just like to write this kind of logic in a linear method instead
of having it scattered in multiple event listener methods.. it's about
code readability and verbosity. Thanks very much for the links, I'm
going to read it carefully.

@Roland: as3commons-async looks nice, it looks that they are trying,
with the Task class, to mitigate the same pain I was talking about. I
think that, without any real "thread locking" API, it can't get much
better than this.

@Martin: that would be an improvement: using premises instead of
creating a lot of ICountProvider and IConditionProvider to express
control flows (probably, they could be built on top of these
interfaces).

I feel like a lot of people tried and are trying to address the
disadvantages of coding async control flows. So I ask myself again:
with worker threads, wouldn't it be simpler to just ask to synchronize
the thread on the async token, i.e. locking it until result/fault?


Cosma


2012/3/26 Justin Mclean <jus...@classsoftware.com>:
> Hi,
>
>> It sounds like you really can't do much about the timing of your bootstrap 
>> if one call is dependent upon the result of your prior call. Even if you had 
>> threads available, you'd be waiting the same amount of time.
>
> Event maps in the Mate framework I find quite useful for this sort of issue 
> (http://mate.asfusion.com/).
>
> Here's a code snippet (from an old Flex3 project I had lying about so might 
> be a little out of date) that give you a feel for event maps in Mate:
>
>        <EventHandlers type="{LoginEvent.ATTEMPT_USERLOGIN}">
>                <RemoteObjectInvoker instance="{service.loginService}" 
> method="getLoggedOnUser">
>                        <resultHandlers>
>                                <MethodInvoker generator="{SelfRegWizard}" 
> method="loginAccountStatus" arguments="{resultObject}" />
>                        </resultHandlers>
>                        <faultHandlers>
>                                <EventAnnouncer generator="{ReportEvent}" 
> constructorArguments="{[ReportEvent.WARNING, 'loginFailed', 'Login Failed']}" 
> />
>                        </faultHandlers>
>                </RemoteObjectInvoker>
>        </EventHandlers>
>
>        <EventHandlers type="{LoginEvent.SUCCESSFUL_LOGIN}">
>                <RemoteObjectInvoker instance="{service.loginService}" 
> method="getLoggedOnUser">
>                        <resultHandlers>
>                                <PropertySetter generator="{SelfRegWizard}" 
> sourceKey="{selfRegModel.newAccount}" targetKey="newAccount"/>
>                        </resultHandlers>
>                </RemoteObjectInvoker>
>        </EventHandlers>
>
> Thanks,
> Justin

Reply via email to