Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Inheritance in Commands  (Read 7675 times)
Elephant
Newbie
*
Posts: 9


View Profile Email
« on: July 16, 2010, 10:48:30 »

I'm working on a PureMVC Multicore application that has several Flex Modules.  There's a bunch of stuff common to all the modules, so I'm having several classes in each module inherit from base classes.

One of these base classes is a CommonStartupCommand, registered to the "startup" Notification in the CommonFacade.

Each module will have a couple of other things to start up, so I have a separate ModuleStartupCommand in each one of those, too.  Unfortunately, I can't just register that command to "startup", too; it'll replace CommonStartupCommand instead of acting in tandem with it.  At this point, I'm weighing two possible architectures to handle this:

One, the ModuleStartupCommand extends CommonStartupCommand, and the execute() function calls super.execute().

Two, implement ModuleStartupCommand as a MacroCommand, calling addSubCommand on both common and specific startup commands.

From what I've read here, option 2 seems more in line with the design philosophy of PureMVC, but option 1 seems a little simpler ... and I haven't seen *any* examples of this type of inheritance between Commands.

Got any advice for me?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 16, 2010, 02:51:21 »

Either approach should work. I'd probably go with inheritance since it's simpler.

-=Cliff>
Logged
Pages: [1]
Print