Javascript preferred way to organize object structure -


i curious standard or common way organize large object structures was. first reaction organize so:

global = {   child_1 : {      obj_1 : null,      obj_2 : null,      func_1 : function () {        //stuff defined here....      }   },   child_2 : {      obj_1 : null,      obj_2 : null,      func_1 : function () {         //stuff defined here....      }   },   child_3 : {     ....  }; 

this pretty @ first, file grows larger , larger , functions defined becomes hard read when functions have same name, such as, "global.child_1.func_1" , "global.child_2.func_1".

is there standard way structure large applications? 1 way keep pretty suppose define functions elsewhere , not inside object hierarchy.

i struggle too. here blog posts find enlightening:

http://michaux.ca/articles/javascript-namespacing

http://javascriptweblog.wordpress.com/2010/12/07/namespacing-in-javascript/#more-1789


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -