Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
interface is the best choice
-> Akshar Kaul <-
Copy link to clipboard
Copied
Can you explain why?
Copy link to clipboard
Copied
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 <-