Skip to main content
May 29, 2011
Question

Communication between modules using cairngorm

  • May 29, 2011
  • 1 reply
  • 2200 views

Hi all,

I'm looking for the best practice of communication between modules using cairngorm.

I read the document which offers three ways (http://livedocs.adobe.com/flex/3/html/help.html?content=modular_7.html😞

1. Using query string

2. Using interfaces   

3. Accessing through parent

However, I am using componentized approach (http://sourceforge.net/adobe/cairngorm/wiki/ApplyingthePresentationModel-ComponentizedvsHierarchical/)

for the presentation model. Meaning I want to use presentor to handle all data passing between modules, and have a presentor which is a part of a module to handle the data passing in the different views of the module.

I am getting a bit confused with the structure when building the app. The main application component is being injected with all the modules and the application presentor.

Do you have a suggestion of a correct structure?

Thanks alot!


Assaf

This topic has been closed for replies.

1 reply

Participating Frequently
May 30, 2011

interface is the best choice

-> Akshar Kaul <-

May 30, 2011

Can you explain why?

Participating Frequently
May 30, 2011

because when you are using interfaces you can check whether the component is

type of that interface. if it is then you can simply type cast it and call

any method you have defined in interface knowing that it wont crash at

runtime.

but in accessing through parent you dont have this control... your

application can crash at runtime if you call some non existing function.

query string a bit too cumbersome to do and if you change something in the

component you have to make changes in every place.

-> Akshar Kaul <-