KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am building a large javascript application and I decided to use Nicholas Zakas' scalable application architecture design: http://developer.yahoo.com/yui/theater/video.php?v=zakas-architecture According to his system, modules are self-encapsulated and do not know about each other... However I have come across many instances in my project where it seemed necessary for modules to know about each other, because they are in essence, the individual parts of a bigger whole. For example.. I have three modules: Upload, Window, and Manager. When clicking on an upload option, a pop-up window opens with an upload form. Also a link is on the window "manager". Clicking the manager link updates the pop-up window to display admin tools... ... It made the most sense for me to do (pseudo code): upload module: upload option click --> sandbox.notification('need pop up window', [...html markup for form...]) manager module: manager link click --> sandbox.notification('need pop up window', [...html markup for admin tools...]) window module: sandbox.listen('need pop up window') --> calls createPopUpWindow( passed in html markup ) ... However this goes against the philosophy because the upload and manager modules are specifically "requesting" the window module to do something, therefore they know about it... So, the only other way I can think of to do this would be: upload module: upload option click --> sandbox.notification('upload option clicked', [...html markup for form...]) manager module: manager link click --> sandbox.notification('manager link clicked', [...html markup for admin tools...]) window module: sandbox.listen('upload option clicked') --> calls createPopUpWindow( passed in html markup ) sandbox.listen('manager link clicked'
Tags (comma-separated)
Save Edits
Cancel