easiest & most flexible is still this:
var myNamespace = {};
myNamespace.foo = function() {
var privateFoo = 1;
this.publicBar = "test";
var privateFn = function() {};
this.publicFn = function() {};
return this;
}
// usage
myFoo = new myNamespace.foo();
as crockford says & in my experience http://javascript.crockford.com/private.htmlthis also allows you to do prototypal inheritance, which is not possible with other "module patterns" - whatever that is, they are just singletons.