Search the web
Sign In
New User? Sign Up
cairngorm-devel · Cairngorm Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 152 - 181 of 210   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#181 From: Bjorn Schultheiss <bjorn.schultheiss@...>
Date: Thu Jul 19, 2007 2:57 am
Subject: Re: Alternative to Chaining Commands Was: RTMP Channel Disconnect Errors
bjorn.schult...
Offline Offline
Send Email Send Email
 
Hey Guys,


Robin, just a question with your chaining solution.

On 18/07/2007, at 5:42 PM, Robin Hilliard wrote:
A Command represents a user action and a Delegate represents a service call 

Are you using 1 command as the responder to multiple delegates (service calls)?


On 12/07/2007, at 11:10 PM, mark_j_ellul wrote:

I agree the chainable events are quite useful, however its not that
useful if you have 2 buttons, like a save and refresh, which both
trigger Cairngorm Events... If the user in their wisdom presses one
directly after the other the call on the delegate causes issue...

The logical solution for this to me would be disable all user gestures while the service call is waiting for a result.


regards,

Bjorn

#180 From: Robin Hilliard <robin@...>
Date: Wed Jul 18, 2007 7:42 am
Subject: Alternative to Chaining Commands Was: RTMP Channel Disconnect Errors
robinhilliardau
Offline Offline
Send Email Send Email
 
Hi All,

Here's an alternative approach to chaining commands  together - we've always gone with state machines in our commands - I took the description of Commands and Delegates very literally from the old Flex book i.e. A Command represents a user action and a Delegate represents a service call, so creating chains of Commands only* because we need to make a sequence of calls seemed to be (respectfully) a case of the tail wagging the dog. 

We have used this on many projects (the most complex had around 15 states with a reasonably involved state diagram), it's easy to work with once the pattern is established.

Here's some pseudo-code:

public class SomeCommand implements ICommand, IResponder {

private const START_STATE : Number = 0;
private const LOGIN_REQUEST : Number = 1;
private const GET_DATA_REQUEST : Number = 1;
// More states...

private var state : Number = START_STATE;

// usual constructor

public function execute (event : CairngormEvent) : void {
result();
}

public function result(event : * = null) : void {
switch(state) {
case START_STATE:
// make login request;
break;
case LOGIN_REQUEST:
// do something with results
// can decide which way to go on state di
// make another request
state = GET_DATA_REQUEST;
break;
case GET_DATA_REQUEST:
// and so on...
}
}

}

I don't feel there's much advantage in breaking this up further as the processing for each state is highly dependant on the others, and it's easier this way to hold the state diagram in your hand and match it up with the case statements.

HTH,
Robin

*sometimes we do fire off new events in a result handler to chain commands together, usually in cases where  the subsequest commands in the chain can also be invoked in isolation.
                                                        

Robin Hilliard

CEO - RocketBoots Pty Limited
Consulting . Recruitment . Software Licensing . Training

m    +61 418 414 341
e    robin@...


On 12/07/2007, at 11:10 PM, mark_j_ellul wrote:

Hi Matt,

I agree the chainable events are quite useful, however its not that
useful if you have 2 buttons, like a save and refresh, which both
trigger Cairngorm Events... If the user in their wisdom presses one
directly after the other the call on the delegate causes issue...


#179 From: "Uber_Nick" <nick.matelli@...>
Date: Mon Jul 16, 2007 6:01 pm
Subject: Re: RTMP Channel Disconnect Errors
Uber_Nick
Offline Offline
Send Email Send Email
 
Thanks Matt and Mark,

I decided to go ahead with the queuing implementation.  It's working
very well so far, but I still think the underlying issue should be fixed.

From my judgement, it's a Cairngorm-only issue, and would be easy for
Adobe to at least write a workaround-type fix.  If this is still an
issue in Flex 3 (is it?), then we should report it as a bug:
http://bugs.adobe.com/jira/secure/BrowseProject.jspa

If you're interested in our queuing system, it was quick to build and
easy to implement.  I created two classes, serialCommandManager and
serialCommand, then added them to my project.

To implement these in the individual Commands, I only had to do the
following:

replaced "implements ICommand, IResponder" with "extends SerialCommand"
replaced "execute" with "serialExecute" and added override keyword
replaced "result" with "serialResult" and added override keyword
replaced "fault" with "serialFault" and added override keyword

If someone's interested in using them, I'll post the files.

#178 From: "mvbaffa" <mvbaffa@...>
Date: Thu Jul 12, 2007 8:18 pm
Subject: Cairngorm and Data Services
mvbaffa
Offline Offline
Send Email Send Email
 
Hi,

I have been working with Cairggorm and RemoteObjects but now I am
beggining my first Data Services project and I would like to know what
are the best practices to work with data services and Cairngorm.

Thanks in advance

#177 From: "mark_j_ellul" <mark.ellul@...>
Date: Thu Jul 12, 2007 1:10 pm
Subject: Re: RTMP Channel Disconnect Errors
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Matt,

I agree the chainable events are quite useful, however its not that
useful if you have 2 buttons, like a save and refresh, which both
trigger Cairngorm Events... If the user in their wisdom presses one
directly after the other the call on the delegate causes issue...

So I have been thinking about creating a "static" queue in my delegate
object, so if the user presses save and then refresh, the refresh call
will not be done until a fault or result is returned from the save call.

Just brainstorming here (as my project has been put on hold) though I
imagine making the delgates themselves be stored in the queue, with
the method and arguments its supposed to do, including which command
called it... I would also make the handlers of the result and fault
events in the delegate tell the queueing layer that its been completed
and then raise the event to the Command object which called it.

Then having a queuing layer which would take the first delegate, start
  doing the method call... assign the delegate's result and fault event
handler to the remote call... The queueing layer could listen to 2
events, one would be MethodCalled (which would be triggered inside of
the delegate to say its been called), the other would be
MethodComplete (again triggered from the delegate when the result has
been returned (whether fault or successful)

Notes:

Though I am sure this would work, I am concerned that Flash player
really only has 2 threads, 1 for UI and another as control...

It would be great to make this totally transparent to the commands
calling the delegate, so you would probably need a method for each
command to call, which would add itself to the queue with all the
parameters and say what method to call, and a second method which does
the call, and possible a map, to link to the two.

Anyway thats my two cents...

Ideally, it would be good for the issue to be resolved instead of
having to build a workaround... but how often does that happen????

Anyone reading have some kind of gold support with Adobe? or from
Adobe and are interested in fixing a potentially huge issue?????

Regards

MarkEMark

--- In cairngorm-devel@yahoogroups.com, "Matt Grande"
<matt.grande@...> wrote:
>
> Hi Nick,
>
> In response to your current work-around of calling several business
> delegates one after the other, you may want to take a look at Bjorn
> Schultheiss' chainable events.  He wrote about them here:
> http://cairngormdocs.org/blog/?p=27
>
> I've been using them on one of my projects and they've always worked
> well, and were surprisingly easy to implement.  Check out his code
sample.
>
> Home this helps,
> - Matt.
>
> --- In cairngorm-devel@yahoogroups.com, "mark_j_ellul"
> <mark.ellul@> wrote:
> >
> > Hi Nick,
> >
> > We were getting something similar with WebServices in the production
> > environment...
> >
> > I was considering building up queuing mechanism in Delegate... though
> > I ended up putting project on hold..
> >
> > Please let me know which way you end up going...
> >
> > My Gut feeling its something within the flash player, because it does
> > not seem to matter what protocol that is used, the errors occur.
> >
> > If you find a solution let me know...
> >
> > Regards
> >
> > Mark
> >
> >
> > --- In cairngorm-devel@yahoogroups.com, "Uber_Nick" <nick.matelli@>
> > wrote:
> > >
> > > We're getting "Channel disconnected" errors when making multiple
calls
> > > to a remote service.
> > >
> > > The situation occurs sporadically when multiple service calls
are made
> > > in a short period of time.  The more calls made at once, the better
> > > chance of an error.  Has anyone has this situation before?
> > >
> > > The Fault being returned:
> > > fault       mx.rpc.Fault (@14d1281)
> > >                 errorID                 0
> > >                 faultCode
"Client.Error.DeliveryInDoubt"
> > >                 faultDetail           "Channel disconnected
before an
> > > acknolwedgement was received"
> > >                 faultString           "Channel disconnected"

> > >
> > >                 message
> > > "faultCode:Client.Error.DeliveryInDoubt faultString:'Channel
> > > disconnected' faultDetail:'Channel disconnected before an
> > > acknolwedgement was received'"
> > >                 name                    "Error"
> > >                 rootCause           null
> > >
> > > The technologies we're using:
> > > Flex 2.01
> > > Flex Data Services (latest before LCDS)
> > > Cairngorm 2.2
> > > Apollo Alpha 1
> > > JBoss 4.0.5GA with ejb3
> > >
> > > Fixes we're considering:
> > > -Restructuring Business delegates to queue service calls and
only make
> > > them one-at-a-time
> > > (This is our functioning workaround, but there's no good way to do
> > > this with Cairngorm)
> > > -Upgrading to LCDS
> > > -Using AMF instead of RTMP channels (required with LCDS)
> > > -Upgrading to Flex3/Apollo Beta (in process)
> > > -Testing different local and remote values on the RTMP channel
> > > -Opening multiple ports on the same remote server to add more RTMP
> > > channels to the channel set
> > >
> > > Our remote service config (ActionScript):
> > > var channelSet:ChannelSet = new ChannelSet();
> > > var channel:Channel = new RTMPChannel("my-rtmp",
> > "rtmp://10.13.1.1:6038");
> > > channelSet.addChannel(channel);
> > > var service:Object = ServiceLocator.getInstance().getRemoteObject(
> > > "myService" );
> > > service.channelSet = channelSet();
> > >
> > > Various calls made:
> > > var call:AsyncToken = service.getSomeWidgets();
> > > var call2:AsyncToken = service.getMoreWidgets();
> > >
> > > Our RemoteObject (mxml, in ServiceLocator instance)
> > > <mx:RemoteObject id="myService" destination="MyService" />
> > >
> > > The remote server's services-config.xml (in FDS's flex.war)
> > > <channel-definition id="my-rtmp"
> > > class="mx.messaging.channels.RTMPChannel">
> > >                 <endpoint uri="rtmp://10.13.1.1:6038"
> > > class="flex.messaging.endpoints.RTMPEndpoint"/>
> > >                 <properties>
> > >
> > > <idle-timeout-minutes>20</idle-timeout-minutes>
> > >
> > > <client-to-server-maxbps>100K</client-to-server-maxbps>
> > >
> > > <server-to-client-maxbps>100K</server-to-client-maxbps>
> > >                 </properties>
> > > </channel-definition>
> > >
> > > Thanks in advance,
> > >
> > > Nick Matelli | Consultant, Amentra Inc.
> > > Email: nick.matelli@
> > > 1775 Wiehle Ave Suite 103, Reston VA 20190
> > >
> >
>

#176 From: "Matt Grande" <matt.grande@...>
Date: Thu Jul 12, 2007 12:07 pm
Subject: Re: RTMP Channel Disconnect Errors
grande_rox
Offline Offline
Send Email Send Email
 
Hi Nick,

In response to your current work-around of calling several business
delegates one after the other, you may want to take a look at Bjorn
Schultheiss' chainable events.  He wrote about them here:
http://cairngormdocs.org/blog/?p=27

I've been using them on one of my projects and they've always worked
well, and were surprisingly easy to implement.  Check out his code sample.

Home this helps,
- Matt.

--- In cairngorm-devel@yahoogroups.com, "mark_j_ellul"
<mark.ellul@...> wrote:
>
> Hi Nick,
>
> We were getting something similar with WebServices in the production
> environment...
>
> I was considering building up queuing mechanism in Delegate... though
> I ended up putting project on hold..
>
> Please let me know which way you end up going...
>
> My Gut feeling its something within the flash player, because it does
> not seem to matter what protocol that is used, the errors occur.
>
> If you find a solution let me know...
>
> Regards
>
> Mark
>
>
> --- In cairngorm-devel@yahoogroups.com, "Uber_Nick" <nick.matelli@>
> wrote:
> >
> > We're getting "Channel disconnected" errors when making multiple calls
> > to a remote service.
> >
> > The situation occurs sporadically when multiple service calls are made
> > in a short period of time.  The more calls made at once, the better
> > chance of an error.  Has anyone has this situation before?
> >
> > The Fault being returned:
> > fault       mx.rpc.Fault (@14d1281)
> >                 errorID                 0
> >                 faultCode            "Client.Error.DeliveryInDoubt"
> >                 faultDetail           "Channel disconnected before an
> > acknolwedgement was received"
> >                 faultString           "Channel disconnected"
> >
> >                 message
> > "faultCode:Client.Error.DeliveryInDoubt faultString:'Channel
> > disconnected' faultDetail:'Channel disconnected before an
> > acknolwedgement was received'"
> >                 name                    "Error"
> >                 rootCause           null
> >
> > The technologies we're using:
> > Flex 2.01
> > Flex Data Services (latest before LCDS)
> > Cairngorm 2.2
> > Apollo Alpha 1
> > JBoss 4.0.5GA with ejb3
> >
> > Fixes we're considering:
> > -Restructuring Business delegates to queue service calls and only make
> > them one-at-a-time
> > (This is our functioning workaround, but there's no good way to do
> > this with Cairngorm)
> > -Upgrading to LCDS
> > -Using AMF instead of RTMP channels (required with LCDS)
> > -Upgrading to Flex3/Apollo Beta (in process)
> > -Testing different local and remote values on the RTMP channel
> > -Opening multiple ports on the same remote server to add more RTMP
> > channels to the channel set
> >
> > Our remote service config (ActionScript):
> > var channelSet:ChannelSet = new ChannelSet();
> > var channel:Channel = new RTMPChannel("my-rtmp",
> "rtmp://10.13.1.1:6038");
> > channelSet.addChannel(channel);
> > var service:Object = ServiceLocator.getInstance().getRemoteObject(
> > "myService" );
> > service.channelSet = channelSet();
> >
> > Various calls made:
> > var call:AsyncToken = service.getSomeWidgets();
> > var call2:AsyncToken = service.getMoreWidgets();
> >
> > Our RemoteObject (mxml, in ServiceLocator instance)
> > <mx:RemoteObject id="myService" destination="MyService" />
> >
> > The remote server's services-config.xml (in FDS's flex.war)
> > <channel-definition id="my-rtmp"
> > class="mx.messaging.channels.RTMPChannel">
> >                 <endpoint uri="rtmp://10.13.1.1:6038"
> > class="flex.messaging.endpoints.RTMPEndpoint"/>
> >                 <properties>
> >
> > <idle-timeout-minutes>20</idle-timeout-minutes>
> >
> > <client-to-server-maxbps>100K</client-to-server-maxbps>
> >
> > <server-to-client-maxbps>100K</server-to-client-maxbps>
> >                 </properties>
> > </channel-definition>
> >
> > Thanks in advance,
> >
> > Nick Matelli | Consultant, Amentra Inc.
> > Email: nick.matelli@
> > 1775 Wiehle Ave Suite 103, Reston VA 20190
> >
>

#175 From: "mark_j_ellul" <mark.ellul@...>
Date: Thu Jul 12, 2007 9:30 am
Subject: Re: RTMP Channel Disconnect Errors
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Nick,

We were getting something similar with WebServices in the production
environment...

I was considering building up queuing mechanism in Delegate... though
I ended up putting project on hold..

Please let me know which way you end up going...

My Gut feeling its something within the flash player, because it does
not seem to matter what protocol that is used, the errors occur.

If you find a solution let me know...

Regards

Mark


--- In cairngorm-devel@yahoogroups.com, "Uber_Nick" <nick.matelli@...>
wrote:
>
> We're getting "Channel disconnected" errors when making multiple calls
> to a remote service.
>
> The situation occurs sporadically when multiple service calls are made
> in a short period of time.  The more calls made at once, the better
> chance of an error.  Has anyone has this situation before?
>
> The Fault being returned:
> fault       mx.rpc.Fault (@14d1281)
>                 errorID                 0
>                 faultCode            "Client.Error.DeliveryInDoubt"
>                 faultDetail           "Channel disconnected before an
> acknolwedgement was received"
>                 faultString           "Channel disconnected"
>
>                 message
> "faultCode:Client.Error.DeliveryInDoubt faultString:'Channel
> disconnected' faultDetail:'Channel disconnected before an
> acknolwedgement was received'"
>                 name                    "Error"
>                 rootCause           null
>
> The technologies we're using:
> Flex 2.01
> Flex Data Services (latest before LCDS)
> Cairngorm 2.2
> Apollo Alpha 1
> JBoss 4.0.5GA with ejb3
>
> Fixes we're considering:
> -Restructuring Business delegates to queue service calls and only make
> them one-at-a-time
> (This is our functioning workaround, but there's no good way to do
> this with Cairngorm)
> -Upgrading to LCDS
> -Using AMF instead of RTMP channels (required with LCDS)
> -Upgrading to Flex3/Apollo Beta (in process)
> -Testing different local and remote values on the RTMP channel
> -Opening multiple ports on the same remote server to add more RTMP
> channels to the channel set
>
> Our remote service config (ActionScript):
> var channelSet:ChannelSet = new ChannelSet();
> var channel:Channel = new RTMPChannel("my-rtmp",
"rtmp://10.13.1.1:6038");
> channelSet.addChannel(channel);
> var service:Object = ServiceLocator.getInstance().getRemoteObject(
> "myService" );
> service.channelSet = channelSet();
>
> Various calls made:
> var call:AsyncToken = service.getSomeWidgets();
> var call2:AsyncToken = service.getMoreWidgets();
>
> Our RemoteObject (mxml, in ServiceLocator instance)
> <mx:RemoteObject id="myService" destination="MyService" />
>
> The remote server's services-config.xml (in FDS's flex.war)
> <channel-definition id="my-rtmp"
> class="mx.messaging.channels.RTMPChannel">
>                 <endpoint uri="rtmp://10.13.1.1:6038"
> class="flex.messaging.endpoints.RTMPEndpoint"/>
>                 <properties>
>
> <idle-timeout-minutes>20</idle-timeout-minutes>
>
> <client-to-server-maxbps>100K</client-to-server-maxbps>
>
> <server-to-client-maxbps>100K</server-to-client-maxbps>
>                 </properties>
> </channel-definition>
>
> Thanks in advance,
>
> Nick Matelli | Consultant, Amentra Inc.
> Email: nick.matelli@...
> 1775 Wiehle Ave Suite 103, Reston VA 20190
>

#174 From: "Uber_Nick" <nick.matelli@...>
Date: Wed Jul 11, 2007 10:06 pm
Subject: RTMP Channel Disconnect Errors
Uber_Nick
Offline Offline
Send Email Send Email
 
We're getting "Channel disconnected" errors when making multiple calls
to a remote service.

The situation occurs sporadically when multiple service calls are made
in a short period of time.  The more calls made at once, the better
chance of an error.  Has anyone has this situation before?

The Fault being returned:
fault       mx.rpc.Fault (@14d1281)
                 errorID                 0
                 faultCode            "Client.Error.DeliveryInDoubt"
                 faultDetail           "Channel disconnected before an
acknolwedgement was received"
                 faultString           "Channel disconnected"

                 message
"faultCode:Client.Error.DeliveryInDoubt faultString:'Channel
disconnected' faultDetail:'Channel disconnected before an
acknolwedgement was received'"
                 name                    "Error"
                 rootCause           null

The technologies we're using:
Flex 2.01
Flex Data Services (latest before LCDS)
Cairngorm 2.2
Apollo Alpha 1
JBoss 4.0.5GA with ejb3

Fixes we're considering:
-Restructuring Business delegates to queue service calls and only make
them one-at-a-time
(This is our functioning workaround, but there's no good way to do
this with Cairngorm)
-Upgrading to LCDS
-Using AMF instead of RTMP channels (required with LCDS)
-Upgrading to Flex3/Apollo Beta (in process)
-Testing different local and remote values on the RTMP channel
-Opening multiple ports on the same remote server to add more RTMP
channels to the channel set

Our remote service config (ActionScript):
var channelSet:ChannelSet = new ChannelSet();
var channel:Channel = new RTMPChannel("my-rtmp", "rtmp://10.13.1.1:6038");
channelSet.addChannel(channel);
var service:Object = ServiceLocator.getInstance().getRemoteObject(
"myService" );
service.channelSet = channelSet();

Various calls made:
var call:AsyncToken = service.getSomeWidgets();
var call2:AsyncToken = service.getMoreWidgets();

Our RemoteObject (mxml, in ServiceLocator instance)
<mx:RemoteObject id="myService" destination="MyService" />

The remote server's services-config.xml (in FDS's flex.war)
<channel-definition id="my-rtmp"
class="mx.messaging.channels.RTMPChannel">
                 <endpoint uri="rtmp://10.13.1.1:6038"
class="flex.messaging.endpoints.RTMPEndpoint"/>
                 <properties>

<idle-timeout-minutes>20</idle-timeout-minutes>

<client-to-server-maxbps>100K</client-to-server-maxbps>

<server-to-client-maxbps>100K</server-to-client-maxbps>
                 </properties>
</channel-definition>

Thanks in advance,

Nick Matelli | Consultant, Amentra Inc.
Email: nick.matelli@...
1775 Wiehle Ave Suite 103, Reston VA 20190

#173 From: "Christophe Herreman" <lists@...>
Date: Wed Jul 11, 2007 3:00 pm
Subject: Dynamic ServiceLocator?
herrodius
Offline Offline
Send Email Send Email
 
Hi all,

I was wondering if the ServiceLocator could be made dynamic in a new release. Here's why: We are programmaticaly adding services based on an external config file (an IoC container does that for us) and the problem is that we can't add services at runtime because the ServiceLocator is sealed. We are currently working around this with a custom servicelocator that extends Cairngorm's ServiceLocator and that has overridden all get* methods, but this is more of a hack than a decent solution.

Any reasons why it would not be a good idea to make it dynamic?

best regards,
Christophe


--
Christophe Herreman
http://www.herrodius.com

#172 From: "Dimitrios Gianninas" <dimitrios.gianninas@...>
Date: Tue Jun 12, 2007 12:37 pm
Subject: RE: Synchronous call to java service in cairngorm framework...
angelone197555
Offline Offline
Send Email Send Email
 

When your apps starts app, show a loading screen, load all the data you need and then switch to the main view and this should work fine. However if you bind your data to the menu, I dont see how this could be a problem.

 
Dimitrios Gianninas
Developer
Optimal Payments Inc.
 


From: cairngorm-devel@yahoogroups.com [mailto:cairngorm-devel@yahoogroups.com] On Behalf Of asik
Sent: Tuesday, June 12, 2007 12:11 AM
To: cairngorm-devel@yahoogroups.com
Subject: [cairngorm-devel] Synchronous call to java service in cairngorm framework...

Synchronous call to java service in cairngorm framework...

I have a menubar which takes an xmllistcollection. I am filling the
collection through a java service call. The problem is, since the call
is asynchronous, menubar gets loaded before the result of the service
call is invoked. My menubar is never filled with the right data.

How do i solve this problem? Is there a way in cairngorm framework
where i could make a synchronous call to java service? Or is there any
other solution???

AVIS IMPORTANT

WARNING

Ce message électronique et ses pičces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce ŕ aucun privilčge ou ŕ aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'ętes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pičces jointes, de votre systčme. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pičces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient ętre illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.

This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender.


#171 From: asik pradhan <measik@...>
Date: Wed Jun 13, 2007 5:33 am
Subject: Re: Re: Synchronous call to java service in cairngorm framework...
measik
Offline Offline
Send Email Send Email
 
hi todd..

thanks so much, it wasn't of much help for the
menubar, but the logic was still helpful for sequnced
event generation..

regards...

asik
--- supertodda <todd@...> wrote:

> I was directed by Mark to this link regarding
> sequenced events which
> helped greatly.  Maybe it will help you out? ...
>
>
http://tech.groups.yahoo.com/group/cairngorm-devel/message/165
>
> -Todd
>
> --- In cairngorm-devel@yahoogroups.com, "asik"
> <measik@...> wrote:
> >
> > Synchronous call to java service in cairngorm
> framework...
> >
> > I have a menubar which takes an xmllistcollection.
> I am filling the
> > collection through a java service call. The
> problem is, since the call
> > is asynchronous, menubar gets loaded before the
> result of the service
> > call is invoked. My menubar is never filled with
> the right data.
> >
> > How do i solve this problem? Is there a way in
> cairngorm framework
> > where i could make a synchronous call to java
> service? Or is there any
> > other solution???
> >
>
>
>




________________________________________________________________________________\
____
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/

#170 From: "supertodda" <todd@...>
Date: Tue Jun 12, 2007 12:37 pm
Subject: Re: Synchronous call to java service in cairngorm framework...
supertodda
Online Now Online Now
Send Email Send Email
 
I was directed by Mark to this link regarding sequenced events which
helped greatly.  Maybe it will help you out? ...

http://tech.groups.yahoo.com/group/cairngorm-devel/message/165

-Todd

--- In cairngorm-devel@yahoogroups.com, "asik" <measik@...> wrote:
>
> Synchronous call to java service in cairngorm framework...
>
> I have a menubar which takes an xmllistcollection. I am filling the
> collection through a java service call. The problem is, since the call
> is asynchronous, menubar gets loaded before the result of the service
> call is invoked. My menubar is never filled with the right data.
>
> How do i solve this problem? Is there a way in cairngorm framework
> where i could make a synchronous call to java service? Or is there any
> other solution???
>

#169 From: "asik" <measik@...>
Date: Tue Jun 12, 2007 4:11 am
Subject: Synchronous call to java service in cairngorm framework...
measik
Offline Offline
Send Email Send Email
 
Synchronous call to java service in cairngorm framework...

I have a menubar which takes an xmllistcollection. I am filling the
collection through a java service call. The problem is, since the call
is asynchronous, menubar gets loaded before the result of the service
call is invoked. My menubar is never filled with the right data.

How do i solve this problem? Is there a way in cairngorm framework
where i could make a synchronous call to java service? Or is there any
other solution???

#168 From: "asik" <measik@...>
Date: Tue Jun 12, 2007 4:10 am
Subject: Synchronous call to java service in cairngorm framework...
measik
Offline Offline
Send Email Send Email
 
I have a menubar which takes an xmllistcollection. I am filling the
collection through a java service call. The problem is, since the call
is asynchronous, menubar gets loaded before the result of the service
call is invoked. My menubar is never filled with the right data.

How do i solve this problem? Is there a way in cairngorm framework
where i could make a synchronous call to java service? Or is there any
other solution???

#167 From: "Matt Grande" <matt.grande@...>
Date: Thu Jun 7, 2007 8:31 pm
Subject: Help! I can't seem to Bind an ArrayCollection!
grande_rox
Offline Offline
Send Email Send Email
 
Does the event fired when something is bound only fire when an equal
sign is used?

For example, this doesn't cause a re-bind:
ValueObject.BoundArrayCollection.addElement(newElement);

But this does:
var array:ArrayCollection = ValueObject.BoundArrayCollection;
array.addElement(newElement);
ValueObject.BoundArrayCollection = array;

#166 From: "Alistair McLeod" <amcleod@...>
Date: Tue Jun 5, 2007 1:55 pm
Subject: RE: Parallel RemoteObject calls by two different Cairngorm events
alimcleod
Offline Offline
Send Email Send Email
 
Hi,

This doesn't sound like Cairngorm, but you may want to create very simple, non-Cairngorm, application to try it out. Similarly, you may want to try it with LiveCycle Data Services, which would indicate whether its AMFPHP or not.

Thanks,

Alistair


From: cairngorm-devel@yahoogroups.com [mailto:cairngorm-devel@yahoogroups.com] On Behalf Of supertodda
Sent: 05 June 2007 12:52
To: cairngorm-devel@yahoogroups.com
Subject: [cairngorm-devel] Parallel RemoteObject calls by two different Cairngorm events

Hello,

I have a situation where I am making two different calls back to a
server via RemoteObject. Each call is triggered within a different
cairngorm event though a delegate. They both are using the same
RemoteObject instance in the Service, going to the same AMFPHP server.
The endpoint URLs are different for each call.

What I'm getting is a situation where if the first call out comes back
first, then the second comes back and the results are handled and
everything is fine. This happens about 1/3 the time. However, if the
second call comes back first, then the results of the first never come
back and it just hangs. If I swap the calls to the Cairngorm events
around, the same behavior is seen.

I've tried just about everything; created more then one RemoteObjects
in the service, calling different services, calling different
functions, creating a new RemoteObject on the fly in the delegate,
each with its own channel… none of this has any effect.

So, does anybody know how to get around this? Is this a flaw if
Cairngorm, Flex or AMFPHP?

Thanks,

-Todd


#165 From: "mark_j_ellul" <mark.ellul@...>
Date: Tue Jun 5, 2007 12:48 pm
Subject: Re: Parallel RemoteObject calls by two different Cairngorm events
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Todd

If you want to sequence you events... Check out
http://cairngormdocs.org/blog/?p=27

I use it in a project where I need events to trigger in a certain
order and it works a treat.

HTH

Mark


--- In cairngorm-devel@yahoogroups.com, "supertodda" <todd@...> wrote:
>
> Hello,
>
> I have a situation where I am making two different calls back to a
> server via RemoteObject.  Each call is triggered within a different
> cairngorm event though a delegate.  They both are using the same
> RemoteObject instance in the Service, going to the same AMFPHP server.
>  The endpoint URLs are different for each call.
>
> What I'm getting is a situation where if the first call out comes back
> first, then the second comes back and the results are handled and
> everything is fine.  This happens about 1/3 the time.  However, if the
> second call comes back first, then the results of the first never come
> back and it just hangs.  If I swap the calls to the Cairngorm events
> around, the same behavior is seen.
>
> I've tried just about everything; created more then one RemoteObjects
> in the service, calling different services, calling different
> functions, creating a new RemoteObject on the fly in the delegate,
> each with its own channelďż˝ none of this has any effect.
>
> So, does anybody know how to get around this?  Is this a flaw if
> Cairngorm, Flex or AMFPHP?
>
> Thanks,
>
> -Todd
>

#164 From: "supertodda" <todd@...>
Date: Tue Jun 5, 2007 11:51 am
Subject: Parallel RemoteObject calls by two different Cairngorm events
supertodda
Online Now Online Now
Send Email Send Email
 
Hello,

I have a situation where I am making two different calls back to a
server via RemoteObject.  Each call is triggered within a different
cairngorm event though a delegate.  They both are using the same
RemoteObject instance in the Service, going to the same AMFPHP server.
  The endpoint URLs are different for each call.

What I'm getting is a situation where if the first call out comes back
first, then the second comes back and the results are handled and
everything is fine.  This happens about 1/3 the time.  However, if the
second call comes back first, then the results of the first never come
back and it just hangs.  If I swap the calls to the Cairngorm events
around, the same behavior is seen.

I've tried just about everything; created more then one RemoteObjects
in the service, calling different services, calling different
functions, creating a new RemoteObject on the fly in the delegate,
each with its own channel… none of this has any effect.

So, does anybody know how to get around this?  Is this a flaw if
Cairngorm, Flex or AMFPHP?

Thanks,

-Todd

#163 From: P Smith <flexcoders@...>
Date: Mon Jun 4, 2007 7:28 pm
Subject: Re: Cairngorm w/ Apollo Embedded Databases
flexcoders
Offline Offline
Send Email Send Email
 
Steven,
 
Thank you for your reply. 
 
Yes, I understand that we should "Let’s wait and see the implementation for Apollo".
 
To clarify what I suspect we will find, Mike Chambers' post implies that the SQLite Database that Apollo will embed will be a client-side only database.  Kind of a better alternative to client-side shared objects or writing data in flat files for client-side persistence. 
 
If my understanding is correct, then no server-side process will be invoked, meaning no potential for involvement of Flex/LiveCycle Data Services.
 
Dissecting Mike's post further, he also states "we are working on aligning the Apollo DB and Gears DB apis ... (on the desktop and in the browser)".  From what Google has put up on the Google Gears site,the database clearly is client-side only.
 
Thank you again,
 
Pete


Steven Webster <swebster@...> wrote:
Let’s wait and see the implementation for Apollo....see how much heavy-lifting is done by Flex/LiveCycle Data Services potentially....


On 4/6/07 16:46, "P Smith" <flexcoders@...> wrote:


 
 

Mike Chambers blogged last week about:
  
Apollo Beta will include SQLite Embedded Database
  
http://www.mikechambers.com/blog/2007/05/30/apollo-beta-will-include-sqlite-embedded-database/ <http://www.mikechambers.com/blog/2007/05/30/apollo-beta-will-include-sqlite-embedded-database/>  
  
 
  
In the Cairngorm microarchitecture, remote calls currently are made by Business Delegates through the ServiceLocator.
  
 
  
What likely will evolve as the recommended way to make embedded database calls?  E.g. will reference to the embedded database be added to the ServiceLocator?
  
 
  
Thanks,
  
 
  
Pete
  




--
Steven Webster
Technical Director
Adobe Consulting
t: +44 (0) 131 338 6108 m: +44 (0) 7917 428 947

Adobe Systems Europe Limited | Registered office: 151 St. Vincent Street, Glasgow G2 5NJ | Company No. SC101089


Shape Yahoo! in your own image. Join our Network Research Panel today!

#162 From: Steven Webster <swebster@...>
Date: Mon Jun 4, 2007 4:47 pm
Subject: Re: Cairngorm w/ Apollo Embedded Databases
swebsteratit...
Offline Offline
Send Email Send Email
 
Let’s wait and see the implementation for Apollo....see how much heavy-lifting is done by Flex/LiveCycle Data Services potentially....


On 4/6/07 16:46, "P Smith" <flexcoders@...> wrote:


 
 

Mike Chambers blogged last week about:
  
Apollo Beta will include SQLite Embedded Database
  
http://www.mikechambers.com/blog/2007/05/30/apollo-beta-will-include-sqlite-embedded-database/ <http://www.mikechambers.com/blog/2007/05/30/apollo-beta-will-include-sqlite-embedded-database/>  
  
 
  
In the Cairngorm microarchitecture, remote calls currently are made by Business Delegates through the ServiceLocator.
  
 
  
What likely will evolve as the recommended way to make embedded database calls?  E.g. will reference to the embedded database be added to the ServiceLocator?
  
 
  
Thanks,
  
 
  
Pete
  

Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool. <http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_ylc=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg-- >
 
    


--
Steven Webster
Technical Director
Adobe Consulting
t: +44 (0) 131 338 6108 m: +44 (0) 7917 428 947

Adobe Systems Europe Limited | Registered office: 151 St. Vincent Street, Glasgow G2 5NJ | Company No. SC101089


#161 From: P Smith <flexcoders@...>
Date: Mon Jun 4, 2007 3:46 pm
Subject: Cairngorm w/ Apollo Embedded Databases
flexcoders
Offline Offline
Send Email Send Email
 
Mike Chambers blogged last week about:
Apollo Beta will include SQLite Embedded Database
 
In the Cairngorm microarchitecture, remote calls currently are made by Business Delegates through the ServiceLocator.
 
What likely will evolve as the recommended way to make embedded database calls?  E.g. will reference to the embedded database be added to the ServiceLocator?
 
Thanks,
 
Pete


Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.

#160 From: "Alistair McLeod" <amcleod@...>
Date: Fri May 25, 2007 5:18 pm
Subject: RE: Flex HotFix 2 and Cairngorm 2.2
alimcleod
Offline Offline
Send Email Send Email
 
I've posted the short term fix, and the long term view, here:
 
 
Thanks,
 
Alistair


From: cairngorm-devel@yahoogroups.com [mailto:cairngorm-devel@yahoogroups.com] On Behalf Of Alistair McLeod
Sent: 25 May 2007 16:47
To: flexcoders@yahoogroups.com; cairngorm-devel@yahoogroups.com
Subject: [cairngorm-devel] Flex HotFix 2 and Cairngorm 2.2

Hi,
 
HotFix 2 for Flex has been released, and as part of that release, some classes have moved from the main SDK into FDS (eg, Consumer). Because of this, applications that use the ServiceLocator class, which contains a soft reference to the Consumer class, will give a compile error since the Consumer class no longer exists in the SDK.
 
We're looking into this at present.
 
Thanks,
 
Alistair
 
Alistair McLeod
Technical Practice Leader (Rich Internet Applications and LiveCycle)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6108
amcleod@adobe.com, http://weblogs.macromedia.com/amcleod
 
Registered office: 151 St. Vincent Street, Glasgow G2 5NJ
Company No. SC101089

 


#159 From: "Alistair McLeod" <amcleod@...>
Date: Fri May 25, 2007 3:47 pm
Subject: Flex HotFix 2 and Cairngorm 2.2
alimcleod
Offline Offline
Send Email Send Email
 
Hi,
 
HotFix 2 for Flex has been released, and as part of that release, some classes have moved from the main SDK into FDS (eg, Consumer). Because of this, applications that use the ServiceLocator class, which contains a soft reference to the Consumer class, will give a compile error since the Consumer class no longer exists in the SDK.
 
We're looking into this at present.
 
Thanks,
 
Alistair
 
Alistair McLeod
Technical Practice Leader (Rich Internet Applications and LiveCycle)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6108
amcleod@..., http://weblogs.macromedia.com/amcleod
 
Registered office: 151 St. Vincent Street, Glasgow G2 5NJ
Company No. SC101089

 

#158 From: "mark_j_ellul" <mark.ellul@...>
Date: Wed May 23, 2007 12:58 pm
Subject: Re: TDD Cairngorm Extension? - Abstract Factory Pattern for Delegate Creation
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Robin,

We I wanted to be able to test my commands and the response handling,
without affecting the production code. However your approach of
storing the service name as a static variable is definitely an
acceptable approach. The reason I did it the way I have is that I can
have many many different Mock RemoteObjects or Mock Webservices in my
test project, thus keeping my production project as slim as possible.

We are looking at a TDD approach to our development, which i got a
little confused with Unit Testing. Its a new approach to me, I am used
to writing the code first and then testing afterwards.

Anyway, I wanted my tests to be able to fake the connections between
the Presentation layer and the Business layer of our system, to prove
for instance that by passing in invalid data to my command, the
service is not actually called. So by creating a inherited
RemoteObject I could put in a public var with a boolean to say if the
method has been indeed triggered, then for tests where the service
should be triggered I could return test data specified in my test itself.

In that I have achieved my aim by creating the mock remote object...

I guess it really depends on what you want to do with Unit testing. My
next step, I would like to be able to mimic user actions and confirm
validation at the presentation layer is working as well...

So in essence, I could have a form, with certain fields as required
fields, and I would like to create tests that fill in the form, say
leaving one of the required fields empty, I will then test on the
enabled state of the submit button of the form.

If anyone has used flex unit to do ui tests, or knows of any resources
to do so, I would be interested in hearing from you.

Thanks and Regards

Mark

--- In cairngorm-devel@yahoogroups.com, Robin Hilliard <robin@...> wrote:
>
> Hi Mark,
>
> It sounds like you're testing more than just the command if you're
> accessing services as well?  In the past when unit testing delegates
> I got the test case to implement IResponder and register itself to be
> the service as well - from memory I think I modified all my delegates
> so that the name of the service they used was in a static variable I
> could override for testing purposes.  This was at a time when
> getService() was less strongly typed (0.99) - I can see this would
> now be an issue with getRemoteObject() and the like...
>
> Cheers,
> Robin
>
>
> ______________
>
> Robin Hilliard
> Director - RocketBoots Pty Ltd
> Consulting . Recruitment . Software Licensing . Training
> http://www.rocketboots.com.au
>
> m    +61 418 414 341
> e    robin@...
>
>
> On 23/05/2007, at 7:11 PM, mark_j_ellul wrote:
>
> > Hi Everyone,
> >
> > I decided to go down the Option 2 Approach.
>

#157 From: Robin Hilliard <robin@...>
Date: Wed May 23, 2007 10:40 am
Subject: Re: Re: TDD Cairngorm Extension? - Abstract Factory Pattern for Delegate Creation
robinhilliardau
Offline Offline
Send Email Send Email
 
Hi Mark,

It sounds like you're testing more than just the command if you're
accessing services as well?  In the past when unit testing delegates
I got the test case to implement IResponder and register itself to be
the service as well - from memory I think I modified all my delegates
so that the name of the service they used was in a static variable I
could override for testing purposes.  This was at a time when
getService() was less strongly typed (0.99) - I can see this would
now be an issue with getRemoteObject() and the like...

Cheers,
Robin


______________

Robin Hilliard
Director - RocketBoots Pty Ltd
Consulting . Recruitment . Software Licensing . Training
http://www.rocketboots.com.au

m    +61 418 414 341
e    robin@...


On 23/05/2007, at 7:11 PM, mark_j_ellul wrote:

> Hi Everyone,
>
> I decided to go down the Option 2 Approach.

#156 From: "mark_j_ellul" <mark.ellul@...>
Date: Wed May 23, 2007 9:11 am
Subject: Re: TDD Cairngorm Extension? - Abstract Factory Pattern for Delegate Creation
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Everyone,

I decided to go down the Option 2 Approach.

The trick was creating a new "services.mxml" which used a Inherited
RemoteObject as my mock object and it was added with the same ID as in
my real application.

I was a little concerned that my tests and the results I was trying to
simulate would be distributed in two different classes the Inherited
RemoteObject and the TestCase. However in my Mock RemoteObject, I
created a function parameter (think of it as a function pointer) which
I pass the value from my TestCase, so in the end the test case and the
result I am passing back are in my TestCase class.

Its a little convoluted, but it packages the test and the results we
want passed back as part of the test in one class.

I Hope this helps anyone in the future..

I am sure this method would work for all the different types of
service objects.

Regards

Mark

--- In cairngorm-devel@yahoogroups.com, "mark_j_ellul"
<mark.ellul@...> wrote:
>
> Hi Everyone,
>
> I have created a couple of Cairngorm based Flex Projects, and I need
> to do unit tests on one.
>
> I am using the RemoteObject with Flex Data Services in the project I
> am trying to write unit tests for. Yes I know they should be written
> before the project, but I am trying to write unit tests now, so I have
> the knowledge to do it the next time before I write the application.
>
> So basically I have one Command (nice and simple) which I am trying to
> unit test. And basically, I want to be able to simulate return values
> from my Delegate or RemoteObject.
>
> This leaves me with two real options to do this:
>
> Option 1 - Abstract Factory pattern for Delegate Creation
>
> So I think if the delegate creation had an Abstract factory pattern, I
> could change the Factory class in my TestCase so I could use a Mock
> Delegate and pass the values back which are consistent with the test
> case. Would this work? Would I create an Instance of the Delegate
> Factory as I do the ServiceLocator?
>
>
> Option 2 - Use the IServiceLocator (as per Cairngorm 2.1 and upwards)
>
> I could use the IServiceLocator to create a instance of my services to
> return Mock Objects and return the values from the method calls.
> However I am at a loss on how to create a Mock RemoteObject.
> Should I just inherit from the RemoteObject class and create the
> methods that the delegate calls and trigger the events as per the Test
> Case requires?
>
> Any help on some direction would be appreciated.
>
> Regards
>
> Mark
>

#155 From: "mark_j_ellul" <mark.ellul@...>
Date: Tue May 22, 2007 9:02 pm
Subject: TDD Cairngorm Extension? - Abstract Factory Pattern for Delegate Creation
mark_j_ellul
Offline Offline
Send Email Send Email
 
Hi Everyone,

I have created a couple of Cairngorm based Flex Projects, and I need
to do unit tests on one.

I am using the RemoteObject with Flex Data Services in the project I
am trying to write unit tests for. Yes I know they should be written
before the project, but I am trying to write unit tests now, so I have
the knowledge to do it the next time before I write the application.

So basically I have one Command (nice and simple) which I am trying to
unit test. And basically, I want to be able to simulate return values
from my Delegate or RemoteObject.

This leaves me with two real options to do this:

Option 1 - Abstract Factory pattern for Delegate Creation

So I think if the delegate creation had an Abstract factory pattern, I
could change the Factory class in my TestCase so I could use a Mock
Delegate and pass the values back which are consistent with the test
case. Would this work? Would I create an Instance of the Delegate
Factory as I do the ServiceLocator?


Option 2 - Use the IServiceLocator (as per Cairngorm 2.1 and upwards)

I could use the IServiceLocator to create a instance of my services to
return Mock Objects and return the values from the method calls.
However I am at a loss on how to create a Mock RemoteObject.
Should I just inherit from the RemoteObject class and create the
methods that the delegate calls and trigger the events as per the Test
Case requires?

Any help on some direction would be appreciated.

Regards

Mark

#154 From: Ilya Devčrs <ilya.devers@...>
Date: Thu May 17, 2007 5:18 pm
Subject: Re: Command Pattern Implementation
idevers1
Offline Offline
Send Email Send Email
 
vijay,

you just add each command once, at app startup time.

addCommand just tells the frontcontroller which command to call when which event occurs...

On 17-mei-2007, at 18:57, RVEEJAY wrote:

Hi all,
   This is first post here and I hope I make sense with it. I was
looking thru the pattern impelementation and wasn't so clear about
Command pattern which is coupled(tied) with Front Controller.

From my understanding, the FrontController receives or listens to
events fired from the components and calls for the relevant
action(class with an execute method) by using the addCommand method.

Now, the FrontController keeps a Dictionary of commands which were
called for, during the lifecycle of the application. Doesn't this
Dictionary object increase in size?? I dont see the use of "Undo" and
"Redo" to keep the history in cairngorm architecture....or have I
completely missed out?

thanks,
vijay




Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    (Yahoo! ID required)

<*> To change settings via email:

<*> To unsubscribe from this group, send an email to:

<*> Your use of Yahoo! Groups is subject to:


--
Ilya Devčrs

INNBERG 
new insights. better concepts. great products.

Botnische golf 9a
3446 CN Woerden, The netherlands
www.innberg.com
+31 (0)646 150 820 (Mobile)
+31 (0)348 486 581




#153 From: "RVEEJAY" <rveejay@...>
Date: Thu May 17, 2007 4:57 pm
Subject: Command Pattern Implementation
RVEEJAY
Offline Offline
Send Email Send Email
 
Hi all,
    This is first post here and I hope I make sense with it. I was
looking thru the pattern impelementation and wasn't so clear about
Command pattern which is coupled(tied) with Front Controller.

From my understanding, the FrontController receives or listens to
events fired from the components and calls for the relevant
action(class with an execute method) by using the addCommand method.

Now, the FrontController keeps a Dictionary of commands which were
called for, during the lifecycle of the application. Doesn't this
Dictionary object increase in size?? I dont see the use of "Undo" and
"Redo" to keep the history in cairngorm architecture....or have I
completely missed out?

thanks,
vijay

#152 From: Robin Hilliard <robin@...>
Date: Sat May 12, 2007 12:15 pm
Subject: Re: Re: Best Practise Question with Cairngorm
robinhilliardau
Offline Offline
Send Email Send Email
 
On 12/05/2007, at 7:40 PM, Steven Webster wrote:
> Interesting to see so many of you still using view helpers.
>
> We (Adobe Consulting) probably haven’t used a ViewHelper for 2 –
> 2.5 years.
>
> Steven

Hi Steven :)

As I've muttered at you a few times at conferences etc I still think
there's some life in the idea - I don't think it's for every
Cairngorm application, or even the majority of them, but I do think
it would be a shame to ignore them, or remove them entirely from the
framework.

Because I think I promised to write up my reasoning re ViewHelpers
for you at some point in the now distant past, here are my views on
the pros and cons of the ViewHelper vs the alternative - coming at it
from two angles, but first:


What is the difference?
-----------------------

So that we're all on the same page for the rest of this rant:

When working with a view helper the command calls a method of an
instance of a view helper class from the view package that may get
some sort of response in the view.  You get the reference to the view
helper through the ViewLocator or sometimes as a parameter to the
command (we had an MDI interface in AFR Access so this was very
common - there could be many instances of a single view at any time).

When working with a model your command has the option of setting one
or more properties of an instance of a model class from the model
package that may get some sort of response in the view.  You get the
reference to the model through the ModelLocator or sometimes as a
parameter to the command (rather like Joe Berkovitz's non-Cairngorm
MVC Architecture presentation at MAX last year, I have done similar
things in Cairngorm on some projects).


Angle 1: Properties vs Methods
-----------------------------------------------

The easiest way to stuff up MVC is to introduce a dependency on the
view into the control/command layer.  The more arms-length you can
be, the fewer assumptions you make about the kind of view you're
working with, the better.

The more your command has to do and the less that the model and view
do, the more opportunities you get to tie your command to a
particular view implementation.  Here is a lame example:  in
SearchCommand.onResult() you say:

     model.results = event.result;
     model.appMode = "searchresult"; // The lame bit!

Ok, so imagine there was a better reason you had to set some flag or
state variable in the model when this result came back - I say the
reasons are out there because this seems to turn up quite often in
command code that I review.  Setting the appMode in this case means
the command perhaps knows more about the view than it needs to (that
it has modes; that they need to be set to particular values in
conjunction with search results coming back).  It would be nicer if
that setting of that flag/state variable happened somewhere other
than the command, e.g:

     view.setSearchResult(event.result);

     ...and in the view helper:

     public function setSearchResult(result : ArrayCollection) : void {
        model.results = result;
        model.appMode = "searchresult";
     }

This view helper method serves a similar purpose to a facade/session
bean/something that hides details of stuff.

Still on the arms-length bit,  it's nice to be very specific about
the exact way your commands can effect the model, to the point where
you may want to define interfaces - and you can't specify properties
on interfaces, only methods (last time I tried getter/setter
functions aren't allowed in AS3 interfaces  - it would be cool).  Now
although as I mentioned earlier in this thread we have done this with
ViewHelpers, on consideration there's no reason you couldn't do this
with models as well:

     package commands {
        public interface ISearchResultModel {
           public function setSearchResult(result : ArrayCollection) :
void;
        }
     }

     ...

     package model {
        public class MyWholeAppModel implements ISearchResultModel,
IStockQuoteResultModel, ... {
           public function setSearchResult(result : ArrayCollection) :
void {
              searchResult = result;
           }
           ...
        }
     }

Now, in the same way IResponder frees up rpc services to work with
anyone implementing an onResult()/onFault() pair, ISearchResultModel
frees up your commands to work with any model with a setSearchResult
().  In practice this can make your commands a lot more reusable.
For example, in AFR Access we had many UIs with corresponding view
helpers that all called a search command to pull back articles
related to the stock/managed fund/suburb/industry sector the view
covered.  All the view helper in question had to do was implement
ISearchViewHelper and it could accept search results (in our MDI
application the view helpers doubled as models - but hey,
ModelLocator was just a marker interface, right?).

So this last point isn't so much about view helpers over models, but
rather calling methods over setting properties from the command.  At
the moment view helpers use methods and models use properties, but
they could both use methods if you find the interface idea appealing.


Angle 2: Who is the keeper of the model?
----------------------------------------

If you use a view helper then the commands access the model through
view code - so the idea here is that the model is the internal state
of the view, managed and owned by (but not dependant on i.e it
doesn't know it's managed or owned by) the view, as opposed to being
something that the controller/commands and view have equal direct
access to.  The model belonging to the view seems to be an accepted
idea in many places, including Eclipse plugins according to a book
I'm reading at present.

But... if models start taking on more responsibilities that currently
reside in the business package (populating themselves, synchronising
with remote data, doing more complex domain model type stuff) rather
than relying on commands to arrange all of this for them, this
picture suddenly goes very wonky.  Arriving in an execute() method
only to immediately go back in to a view helper to tell a model to
populate itself with a search doesn't make any sense at all.

This new approach looks more suitable as you move away from classic
request/response RPC with real time apps using FDS and the like, and
you were indicating this is where Adobe Consulting's collective head
was heading the last time we caught up at MAX (note: not meaning to
put words in your mouth, please correct me if this isn't right).

So to summarise, the view is the keeper of the model at the moment
(ViewHelper good), but in the not so distant future the model will
have to be directly accessible by everyone (ViewHelper useless).






Anyway, there's my take on view helpers to add to the collective
wisdom (or otherwise).  To the incidental reader, if this didn't make
sense the best idea is to stay with the program and ignore view
helpers - they are not a best practise.  If it did make sense, I hope
it helps you decide when they could be useful for your project.

Cheers,
Robin



______________

Robin Hilliard
Director - RocketBoots Pty Ltd
Consulting . Recruitment . Software Licensing . Training
http://www.rocketboots.com.au

For schedule/availability call Pamela Higgins:
w    +61 7 5451 0362
m    +61 419 677 151
f    +61 3 9923 6261
e    pam@...

or Direct:
m    +61 418 414 341
e    robin@...

Messages 152 - 181 of 210   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help