|
On 16/06/2005, at 7:51 PM, Steven Webster wrote:
Working with ColdFusion there's one thing that I'm now doing differently to the sample code - I get the delegate to intercept the server result and copy the values into an instance of the correct VO type, then call the original responder's onResult() method. This is because of an experience I had in an earlier Flash/Cairngorm app, where I discovered that what I thought was an instance of a particular VO type with some getter/setter logic (which I do occasionally use in VOs) was actually a vanilla object with no getter/setters - I had assumed that somehow the cast in my Command's onResult had turned it into the type I wanted, where in fact all it does is stop the compiler generating a type mismatch for that line of code. Andrew has just blogged about this on FlexDaddy. So for Kent, the above is one instance of the separation of the Command/Delegate being useful by hiding a server specific issue (ColdFusion's loose typing) in the Delegate. Another similar example is a Flex application we're working on that communicates in xml request/response strings with the server. All the creation of the xml request string and the parsing of the response are handled in the delegates - if we swap to a non-xml format later then the Commands will be none the wiser, they work exclusively with VOs. Finally, in the same application we have a few commands that trigger off a string of four or more server calls via delegates in a row, so the mapping of commands to delegates is 1:many (I've written a little state-machine logic in my commands onResult using (gasp) a case statement - unfortunately I haven't seen Steven's solution for this in 0.99 at this point, will have a look soon but it may take a bit to tear me from my state machines, which work rather nicely). Cheers, Robin
Yahoo! Groups Links
|
- Re: [flexcoders] Flash + Cairngorm Example With Source Code Robin Hilliard
- RE: [flexcoders] Flash + Cairngorm Example With Source... Kent Henneuse
- RE: [flexcoders] Flash + Cairngorm Example With So... Steven Webster

