PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: Elephant on July 16, 2010, 10:48:30



Title: Inheritance in Commands
Post by: Elephant 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?


Title: Re: Inheritance in Commands
Post by: puremvc on July 16, 2010, 02:51:21
Either approach should work. I'd probably go with inheritance since it's simpler.

-=Cliff>