Re: [flexcoders] AIR Cairngorm Application Command Architecture

2008-11-19 Thread Robin Hilliard

On 19/11/2008, at 9:59 AM, zwigby wrote:


So I was thinking of each calculation being a command and
then the steps would be helper classes that use delegates to get the
information from local database. Any thoughts would be great. Thanks
in advance.



Hi Zwigby,

All your calculation helpers and data access delegates are part of  
your business package (not everything in business has to be a remote  
service delegate - it's also home to filters, validators, formatters  
and the kind of helper utilities you describe).  As you suggest you  
would instantiate and call these business classes from a command*.


When in doubt, my rule of thumb is to strictly think of a command  
being responsible for co-ordinating responses to a single user action,  
so if there was one act to kick off the calculations I would write one  
command and get it to run all the calculations, even going to the  
extent of making multiple asynchronous calls if necessary or writing a  
little state machine to keep track of things - this is when having  
command logic in it's own class gives you the elbow room to do more  
complex stuff.  BTW commands don't have to implement IResponder if  
they aren't calling asynchronous methods.


HTH,
Robin

*or occasionally directly from the view, if what you're doing isn't  
changing the model.  Think of the way the Flex SDK validators and  
formatters are used in views all the time - they are really business  
classes helping the view out.  Dependency and isolation-wise the  
important bit is that they themselves don't know they're helping the  
view.



ROBIN HILLIARD
Chief Executive Officer
[EMAIL PROTECTED]

RocketBoots Pty Ltd
Level 11
189 Kent Street
Sydney NSW 2001
Australia
Phone +61 2 9323 2507
Facsimile +61 2 9323 2501
Mobile +61 418 414 341
www.rocketboots.com.au  





[flexcoders] AIR Cairngorm Application Command Architecture

2008-11-18 Thread zwigby
I have question about setting up an air application architecture using 
cairngorm commands. So the application has very complex calculations 
that have be done in steps and I am not sure the best way to lay them 
out in cairngorm. A general example is as follows: there are 5 
different calculations which can be done. Each of these calculations 
involves multiple steps. Each step may have to lookup information in 
the local database. Some of the steps are reused from calculation to 
calculation. So I was thinking of each calculation being a command and 
then the steps would be helper classes that use delegates to get the 
information from local database. Any thoughts would be great. Thanks 
in advance.