I can't see how you'd benefit from sidestepping the cairngorm event -> command 
way of working in this case.
If you use a service to get the IP address then it's asynchronous, and has a 
few possible outcomes.
I can't see why you wouldn't want to wait for it's "got one of those results or 
an error" event and then deal with the outcome.
Which is where the cairngorm way of doing things is really helpful.

If it's synchronous (like opening a database or prefs file in AIR, say), then 
you could maybe skip cairngorm (I do, and get away with it, mostly).
In which case I can't see the benefit of thinking of (or packaging ) it as a 
cairngorm command. I'd rather put it somewhere else and know it was a different 
thing.

But what I've found most of the time is that if you're going to do a cairngorm 
app then it's really worth going with the flow and doing pretty well everything 
that way,
even if it does mean writing 3 classes when you could get away with a local 
method.
Generally, when I've made short cuts like that it's come back and bitten me on 
the arse.
I do still do it when I'm in experimental/creative or lazy mode, but now I'll 
try to refactor it into the cairngorm way sooner rather than later.
Which is sometimes a bit boring, but there you go.

Hope that makes (at least some) sense!



-----Original Message-----
From: flexcoders@yahoogroups.com on behalf of chigwell23
Sent: Thu 01/05/2008 22:51
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm - always event, always command?
 
pseudocode:

creationComplete
    var ipAddress:String
    ipAddress = getUserIP()


function getuserIP():String{

   // use Services to go out to ColdFusion which can tell me user IP
   return IP
   }

But Cairngorm encapsulates "actions" into commands which are driven by
an event and a delegate. So how does it handle examples like the one
above? Should I create a getIP event, which is dispatched from
creationComplete, and use the standard command/delegate path. If the
event is not necessary, and it still makes sense to put the "action"
in a command, how would that command get activated without the
Cairngorm event process? I know what I mean <grin>. TIA,

Mic.



______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
______________________________________________________________________

<<winmail.dat>>

Reply via email to