Monday, October 8th, 2007

Introducing: Modular

By Andy Lewisohn

I’m a big fan of Cairngorm, I use it extensively in my projects and have always been happy with the results. That was until I tried getting it to work with Modules. All of a sudden, Cairngorm didn’t seem so hot. Not one to just let go of a tried and true architecture, I decided to come up with a solution. There’s been quite a bit of talk already on this subject, and my answer is based on some of what I found. It’s over in the lab, check it out: Modular.

14 Responses

  1. Bjorn said:

    good looking Andy,
    It was was cool how you rolled in the eventSequencing into the dispatcher, dope..
    I’ve just got to the stage where after having reverted from Modules to the monolithic app, i now have to roll back to modules, so i’ll definitely be making use of your work.
    Your work is a good start.
    From memory there are still a few areas to address.
    I think you need a Module wrapper, like CairngormModule.
    It should facilitate unloading, passing data between ModelLocators and bindings.
    Since the recent changes to Modules and the support from Alex Harai on a few key issues I believe that making Cairngorm and Modules work is definitely be possible.
    Bjorn

  2. Bjorn said:

    Hey Andy,
    Check out the Event Sequencing in the Prana framework svn.
    http://www.herrodius.com/blog/?p=81
    Bjorn

  3. Dennis said:

    looks promising. I’m not that experienced in using Modules and Cairngorm so I was wondering how the situation with loading a cairngorm enabled module in a cairngorm enabled application ends up. They share the controller ? They share modellocator ? Or can I use a different FrontController and ModelLocator in both the module and application ?
    thanks,
    Dennis

  4. Dennis said:

    allright. After some digging into it looks like only the Modules need their classes derived from Modular right ? getAssociatedFactory will never keep returning null for the shell application if I understand it correct…
    anyone able to confirm this ?

  5. Andy Lewisohn said:

    Dennis,
    That’s right. Only the modules need to use Modular. Your parent application just uses the regular Cairngorm library. My modules have their own front controller and their own models.
    -Andy

  6. Dennis said:

    Hi Andy,
    thanks for the confirmation. It works great now. I was wondering how you are dealing with parent-module communication. Do you use Cairngorm for that ?
    Dennis

  7. foreclosure solutions said:

    Thanks for pointing me to this valuable resource.

  8. rmunix said:

    This is great, I really hope to be able to use it, does any one have an example or tutorial on how to use this.

  9. John Wilker said:

    any updates on this or examples? Not that I don’t want to experiment, but examples never hurt :)
    Good work!

  10. Vu said:

    This does NOT work with multiple instances of the same module.
    ModuleManager.getAssociatedFactory(obj).name returns the same name for the same module factory
    You still need to pass a unique id to each of your module, and create new instances of CairngormEventDispatcher accordingly

  11. Pedro Sena said:

    Hi Guys, I’m having a problem trying to use Modular.
    All my modules are subclass of TitleWindow, so I’m using:
    [Frame(factoryClass="mx.core.FlexModuleFactory")]
    public class ReservaWebBaseModule extends TitleWindow
    So far so good, no problem to load it neither to manage my modules. The problem comes when I try to use the cairngorm in my modules (my shell is very simple and does not need cairngorm).
    I created a event do unload my modules, that event it dispatched from my ReservaWebBaseModule class, that is the parent class of all my modules. Even using Modular classes, my event is executed N times, where N = number of modules loadded.
    I have a frontController for each module(each frontController is subclass of ModuleFrontController) and my UnloadModuleEvent is subclass of AbstractModuleEvent
    I tried to put this metatag in each subclass of my main module class but the problem persists. Do I need to create my own subclass of mx.core.FlexModuleFactory to make what I want ?
    Suggestions are welcome
    Thanks in advance

  12. Camilo said:

    Hi Guys, just a question:
    should i extend ModuleSequenceCommand for any command that i use inside a module, or just for sequence commands?
    thanks in advance

  13. Ruprict said:

    Is anyone still using this? It looks promising….
    Thanks!

  14. bookmarking site said:

    Thanks for developing it. Now, Cairngorm gets hot again. Good and neat job.

Leave a Comment