[JSMentors] Improved Module Pattern?

2010-12-31 Thread jemptymethod
Please consider the following template. Sure its a little verbose, but Uncle Bob declare comments to be failures, so I'm trying to obviate such failure with the identifiers $private and $public. Also the nested closures allow all state to be hidden with $private, and for code (e.g.

Re: [JSMentors] Improved Module Pattern?

2010-12-31 Thread אריה גלזר
Maybe it's because of the lack of real examples, but I failed to understand the need for so many closures: 1. Why do you create a list of private methods that even the inner module cannot access? 2. Why make the constructor private? 3. Why wrap the public with a closure? why not simply return it?