Thanks a lot for your response.

I continue inserting comments in your message bellow... please let me
know your thoughts.

--- In flexcoders@yahoogroups.com, "Daniel Gold" <[EMAIL PROTECTED]> wrote:
>
> Cairngorm as a framework is pretty loose in that it allows you to
shortcut
> parts that may not feel right to you, and you can subclass and of
the pieces
> to expand on the implementation. The Universal Mind extension is a good
> example of this:
> 
> http://code.google.com/p/flexcairngorm/
> 

I know UM and, sure, i will use it because i dont allways need a
centralized model. I prefer to get a callback to the view with the
result. UM allows this and much more.

> There have been quite a few threads on flexcoders about Cairngorm
and MVC
> and everyone's personal(and sometimes evangelical) beliefs.
> 

In my case its not a belief question. In fact i am a software advisor
and i have been playing with Cairgorn last feew weeks. I must be able
to explain clearly to the development team the concepts behind
Cairngorm, and when to use a command or not, for example.

> Personally, I don't normally store view state in the model like the
store
> does with its "selectedItem".  I think where you may be losing the
concept
> of events/commands is with server side vs client side changes.
Usually an
> event is dispatched and a command is triggered when a data operation
occurse
> such as a find or a save that will invoke the "backend". That doesn't
> necessarily mean the server as you could be writing an AIR
application that
> communicates with the local SQLLite database, but the application
doesn't
> care down to the delegate layer that will route the data to the correct
> "backend", whatever service that may be. In the store example the
> selectedItem is only useful for views so the views modify and bind
to that
> variable on the model. I usually try to leave that kind of view only
data
> out of the model and pass it around in the application where necessary
> instead.

Yes, its a posibility that i have already considered. But in the store
sample they have the "AddProductToShoppingCartCommand"
"FilterProductsCommand", for example. None of them use the backend.

I seems to me that commands are not user gestures, nor clicks or
backend queries. The only posible explanation to me is as use cases
are abstract (What kind of things can the the user do?) so there is no
a fixed rule.

I think is a weak flavour of the command pattern, so is of useness for
things like undo, etc. I this is the case, the there is no need to
follow the rules strictly.

In essence a methodology to identify commands could be:
1. Try to hold the view state in the view.
2. Determine the use cases, and make a command for each one.
3. Any backend query is also a command.
4. If you need to update the model from the view, don't do it
directly. You have discovered a new command an probably a use case.

> 
> It sounds like you understand most of the concepts but just take
exception
> to certain parts of the framework, which is fine. Use it however you see
> fit, if you're at odds with a framework then it's not going to be a
pleasant
> development experience.
> 

Yes, i am only trying to implement a methodology and best practices.
Later each programmer will use some shortcuts when needed, for sure.

> As far as your question about the get commands, most of the time you
will
> see separate events and commands for each set of 'domain' objects
you deal
> with. Sometimes there is a need to load a ton of data up front, and you
> could have an init function that fires all of the appropraite get
commands.
> Most of the time it's probably better to delay getting certain pieces of
> data until the user navigates to that section of the app. The

Yes, i agree. This is the idea. But, do you think it's ok to call two
or more delegates in one single command to retrieve several pieces of
data from the server before entering some view, or should i create
diferent commands?. I prefer the second option, for reusability
reasons, but then we arrive to the command sequencing problem. The
SequenceCommand provided by Cairngorm is a horrible solution.

> event=command=server request is just part of the MVC pattern and
keeps some
> nice separation so you dont have one monolithic event and command
requesting
> and parsing all of the data. Keep in mind one of the biggest pros of
using a
> framework is maintenance. If you're having a problem with your
products list
> not loading correctly, you'll know to look in the chaing of the
> GetProductsEvent, GetProductsCommand, and ProductDelegate rather than
> digging through thousands of lines in a single command.

Yes, this is a good reason to adopt it.

> 
> On Thu, Jul 10, 2008 at 9:10 AM, oscar.12321 <[EMAIL PROTECTED]> wrote:
> 
> >   Yes. I know this diagram and, as i said, i have been browsing and
> > reading all over Internet, including forums, articles, tutorials, etc.
> >
> > My questions remain unsolved. For example, i see no arrows from view
> > to model like the Cairgorm Store sample does.
> >
> > Anyway, thank you.
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
"Douglas
> > Knudsen"
> >
> > <douglasknudsen@> wrote:
> > >
> > > have a go at this
> > > http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf
> > >
> > > DK
> > >
> > > On Thu, Jul 10, 2008 at 7:37 AM, oscar.12321 <oscar.12321@> wrote:
> > > > I have the past few days reading about Cairngorm and, at all,
i don't
> > > > understand the concept behind de events and commands.
> > > >
> > > > The people says that a event-command pair corresponds to a user
> > > > gesture or system event: clicks, app init, etc. But when i
browse the
> > > > Cairngorm store app i found things like these:
> > > >
> > > > - Command modifies the model and the model notifies the view throw
> > > > bindings: this seems logic to me.
> > > >
> > > > - Selecting a product in the view directly changes the
> > > > model.selectedItem: where is the command?. What we have here
is a user
> > > > gesture and a model update without Cairngorm event or command.
> > > >
> > > > - Retrieving the products with a GetProductsCommand: what kind of
> > > > event+command is this?. The system event shold be appInit or
the like,
> > > > and then usually you need to retrieve many things, not only
products.
> > > > Why server request = command?
> > > >
> > > > - Finally, the checkout process is divided in a sequence of
commands.
> > > > The user gesture is checkout, but the app uses serveral commands.
> > > >
> > > > This has no sense for me. I think the theory was right, but when
> > > > applied is twisted to match the framework limitations.
> > > >
> > > > This is suposed to be the mother of the samples (an the only
one, i
> > > > think).
> > > >
> > > > Could any one clarify me when to use a command an how to
explain the
> > > > concept to other people?
> > > >
> > > > Thanks
> > > >
> > > > - Oscar
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Douglas Knudsen
> > > http://www.cubicleman.com
> > > this is my signature, like it?
> > >
> >
> >  
> >
>


Reply via email to