Why I don't love JavaScript's Module Pattern
Came across this a few weeks ago, and though I thought Snook's points were valid, I dismissed this post as wishful thinking -- wishful thinking in that avoiding the module pattern is virtually impossible in JavaScript, especially if you use a library like YUI, which he cites in the post. Really, it's XHR that makes the use of enclosures a near must. Having said that, I just put some code through review on Launchpad that I felt was unnecessarily complex because of the use of enclosures, the "module pattern" as he calls it. I will be refactoring the code in a later branch and will definitely try to limit enclosure use to simplify the code, but still, I'm skeptical I'll get the code as nice as I would like. There's just something about asynchronous code in JavaScript that gets complex quickly, especially when dealing with many XHRs or multiple levels of XHRs.

