explorers’ club


The Sequence Command Revived.
Tuesday, June 19, 2007, 12:06 pm
Filed under: development, flex

Ok, so its been nearly a month since I last posted. I have been in a royal funk lately.

So there had been some interest in the whole Sequence Command thing awhile back. And I had never really followed through. So now that I have some free time, I am reviving the initiative. If you like, you can get a refresher (part a, part b). But today’s post is going to be more of a request for input from fellow developers. So let’s get started.

So the issue currently is this: I am wanting to enforce a contract for those who plan to use this ‘framework’ (for lack of a better word). Contract immediately sparks to mind the term interface. But I feel that an interface is too loose, too democratic, too free. Specifically I want the developer to make sure to dispatch the following events on their respective triggers:

  • CommandBaseEvent.EXECUTE
  • CommandBaseEvent.FAULT
  • CommandBaseEvent.RESULT

If I were to make the CommandBase class an interface (ICommandBase?) then I would have to rely on developers to make sure to dispatch those events themselves. If I were to go the inheritance route, I would still have to rely on developers to make sure to call the super’s methods that are getting overridden. So I am a bit stuck and having an OCD moment here. What to do? Should I:

  • use an interface
  • use inheritence
  • use an interface that require dispatchEventMethods such as dispatchExecuteEvent, dispatchFaultEvent, dispatchResultEvent

I would love some input from the community.


3 Comments so far
Leave a comment

Do you have an example of what you are trying to accomplish with the Sequence Command? I’ve been working with the PureMVC Framework (http://puremvc.org) and it contains a MacroCommand and SimpleCommand. The MacroCommand allows you to chain both Macro and Simple commands using addSubCommand(..) method.

Comment by Michael Ramirez

Hi Michael,

Thanks for the info. I haven’t been able to really get an example up and running due to time restraints, however I am currently working towards that goal. But the reasons why I took on this task were to:

1) Expand upon the Cairngorm framework
2) Facilitate code reuse (rather than have one simple command and then have its twin for sequence command usage)
3) Have fun making something that is good even better

I have heard of PureMVC and looked at their API. I am doing something very similar to the Macro/Simple Command structure they have. The reason for my doing this for Cairngorm is that the Cairngorm framework is widely adopted as the defacto standard in Flex RIAs. At some point I may find time to play with PureMVC.

Thank you for the suggestion though.

Comment by jwopitz

Hey, just came across your post. I’m not sure I’d be so hung up on ensuring that the developer calls super.fault() or raised the event themselves. AFterall, the Cairngorm framework doesn’t have in place ensuring these types of things. And this is the type of error that a unit test would catch.

(Not sure if you’re still working on the ideal MacroCommand/ChainedCommand,SequenceCOmmand for Cairngorm.)

Comment by Todd




Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>