> > > [snip top posted prev msgs]. > See also: > <http://en.wikipedia.org/wiki/Posting_style#Interleaved_style> > > The technical ideas are fine, but I do not agree that they are the > solution. And actually, in this case, pulling everything into one > large global function will result in a one big function. > > Doing that just transfers the ball of mud from being global to being > namespaced. No benefit is gained. It can actually be harder to work > with. I remember `YAHOO.mst.code`; where they'd taken the "Crockford" > module pattern and placed all of the application code in a closure. > The interface object did not have a specific role. Trying to extract > thing like the tooltip code from that 1100+ line blob of a closure was > difficult. There were parts related to the scheduler, and I can't > remember what else. > > I did then what I advocate now: I attempted to organize and group bits > of functionality into abstractions. Even if the abstraction is only > used in one place, just take that chunk out and put it on its own, > away from the page implementation code. That way, it was easier to > read what the page implementation code was doing without wading > through all those LOC. > > Don't stuff everything into the closet; get it organized. > > Garrett > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/jsmentors@jsmentors.com/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/jsmentors@googlegroups.com/ > > To unsubscribe from this group, send email to > jsmentors+unsubscr...@googlegroups.com<jsmentors%2bunsubscr...@googlegroups.com> >
I agree, pulling the code out each of the global functions and into separate namespaced functions is only the first step. Once the code is hidden behind a wrapper, you can start to pull out functionality from the big balls of mud and organize them into different namespaces. I suppose you could skip the step where you pull the code out of the global function and instead just start refactoring and re-organizing the code in the global function. I often put things into a namespace so I don't have to worry about testing the globals. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com