How should modules access data outside their scope?

Posted by Joe on Programmers See other posts from Programmers or by Joe
Published on 2013-06-28T15:07:31Z Indexed on 2013/06/28 16:29 UTC
Read the original article Hit count: 290

I run into this same problem quite often. First, I create a namespace and then add modules to this namespace. Then issue I always run into is how best to initialize the application? Naturally, each module has its own startup procedure so should this data(not code in some cases, just a list of items to run) stay with the module? Or should there be a startup procedure in the global namespace which has the startup data for ALL the modules.

Which is the more robust way of organizing this situation? Should some things be made centralized or should there be strict adherence to modules encapsulating everything about themselves?

Though this is a general architecture questions, Javascript centric answers would be really appreciated!

© Programmers or respective owner

Related posts about JavaScript

Related posts about architecture