<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: No love for the module pattern?</title>
	<atom:link href="http://ajaxian.com/archives/no-love-for-the-module-pattern/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/no-love-for-the-module-pattern</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: elGinge</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273349</link>
		<dc:creator>elGinge</dc:creator>
		<pubDate>Thu, 07 May 2009 08:44:51 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273349</guid>
		<description>Surely the module pattern as a singleton is fine, used in manager functions and single instances where is the need for extension?

I use it all the time as it gives a clear definition of what is meant to be where. If you want to have many objects of the same class or extension etc use a different pattern. 

If you want to declare private members of prototyped objects just prefix them with _ it&#039;s not very hard to follow.

2Pence.</description>
		<content:encoded><![CDATA[<p>Surely the module pattern as a singleton is fine, used in manager functions and single instances where is the need for extension?</p>
<p>I use it all the time as it gives a clear definition of what is meant to be where. If you want to have many objects of the same class or extension etc use a different pattern. </p>
<p>If you want to declare private members of prototyped objects just prefix them with _ it&#8217;s not very hard to follow.</p>
<p>2Pence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FrankThuerigen</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273343</link>
		<dc:creator>FrankThuerigen</dc:creator>
		<pubDate>Wed, 06 May 2009 14:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273343</guid>
		<description>I´m using the module pattern mostly. One reason that I missed in the other comments is that it allows for parameter checking in the public part and processing in the private part. I find this very useful, since for distributed projects you have a declarative part and a seperated processing part which makes it much easier to read.</description>
		<content:encoded><![CDATA[<p>I´m using the module pattern mostly. One reason that I missed in the other comments is that it allows for parameter checking in the public part and processing in the private part. I find this very useful, since for distributed projects you have a declarative part and a seperated processing part which makes it much easier to read.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jpedrosa</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273332</link>
		<dc:creator>jpedrosa</dc:creator>
		<pubDate>Tue, 05 May 2009 16:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273332</guid>
		<description>The module pattern makes my head hurt. :-)

After having written a dozen of JavaScript library files and coming up with my own pattern for handling semi-private data, all the while making use of Prototype&#039;s OO mechanism, plus failing to use and like the YUI library in its 3.0 development version...

I would rather avoid any extra headache at this point.

Microsoft with Novell and Mono just gave me another one a few minutes ago. Novell&#039;s Miguel de Izaca announced Moonlight 1.9 beta and I installed it and went where I could find Silverlight demos and I could not manage to see any Silverlight content using Moonlight after some three tries. Just uninstalled Moonlight thinking &quot;thank goodness JavaScript can help me with staying out of too much trouble&quot;.</description>
		<content:encoded><![CDATA[<p>The module pattern makes my head hurt. :-)</p>
<p>After having written a dozen of JavaScript library files and coming up with my own pattern for handling semi-private data, all the while making use of Prototype&#8217;s OO mechanism, plus failing to use and like the YUI library in its 3.0 development version&#8230;</p>
<p>I would rather avoid any extra headache at this point.</p>
<p>Microsoft with Novell and Mono just gave me another one a few minutes ago. Novell&#8217;s Miguel de Izaca announced Moonlight 1.9 beta and I installed it and went where I could find Silverlight demos and I could not manage to see any Silverlight content using Moonlight after some three tries. Just uninstalled Moonlight thinking &#8220;thank goodness JavaScript can help me with staying out of too much trouble&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WebReflection</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273330</link>
		<dc:creator>WebReflection</dc:creator>
		<pubDate>Tue, 05 May 2009 15:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273330</guid>
		<description>@DmitryBaranovskiy, primitives are &quot;not 100% Objects&quot; but inherit from their own constructor prototypes. In JavaScript Object.prototype is not instanceof Object but in any case, I will never understand why so often Java/C#/whatever developers think that in JS inheritance is bad ... if we do not get prototypal inheritance it cannot be a language problem, don&#039;t you agree? Finally, module pattern is useful when you need it, if you program everything with module pattern I agree there is something wrong. But, when we need it, what&#039;s wrong with this?
&lt;code&gt;
function Module(name){

    // privileged
    this.getName = function(){
        return name;
    };

};

Module.prototype = new function(){

    // private methods
    function private(){
        return [
            &quot;asked for&quot;, this.getName(), ++_times, &quot;times&quot;
        ].join(&quot; &quot;);
    };

    // private vars
    var _times = 0;

    // public methods
    this.ask = function(){
        return private.call(this);
    };

    // public vars
    this.constructor = Module;

};

var m = new Module(&quot;pattern&quot;);
m.ask();
// asked for pattern 1 times
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@DmitryBaranovskiy, primitives are &#8220;not 100% Objects&#8221; but inherit from their own constructor prototypes. In JavaScript Object.prototype is not instanceof Object but in any case, I will never understand why so often Java/C#/whatever developers think that in JS inheritance is bad &#8230; if we do not get prototypal inheritance it cannot be a language problem, don&#8217;t you agree? Finally, module pattern is useful when you need it, if you program everything with module pattern I agree there is something wrong. But, when we need it, what&#8217;s wrong with this?<br />
<code><br />
function Module(name){</p>
<p>    // privileged<br />
    this.getName = function(){<br />
        return name;<br />
    };</p>
<p>};</p>
<p>Module.prototype = new function(){</p>
<p>    // private methods<br />
    function private(){<br />
        return [<br />
            "asked for", this.getName(), ++_times, "times"<br />
        ].join(" ");<br />
    };</p>
<p>    // private vars<br />
    var _times = 0;</p>
<p>    // public methods<br />
    this.ask = function(){<br />
        return private.call(this);<br />
    };</p>
<p>    // public vars<br />
    this.constructor = Module;</p>
<p>};</p>
<p>var m = new Module("pattern");<br />
m.ask();<br />
// asked for pattern 1 times<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sixtyseconds</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273324</link>
		<dc:creator>sixtyseconds</dc:creator>
		<pubDate>Tue, 05 May 2009 10:44:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273324</guid>
		<description>Thanks Adam! &#039;m fascinated by this notation :)</description>
		<content:encoded><![CDATA[<p>Thanks Adam! &#8216;m fascinated by this notation :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adoro</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273321</link>
		<dc:creator>Adoro</dc:creator>
		<pubDate>Tue, 05 May 2009 07:59:49 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273321</guid>
		<description>Oops, I should have said &quot;pattern&quot; as opposed to &quot;better&quot;.</description>
		<content:encoded><![CDATA[<p>Oops, I should have said &#8220;pattern&#8221; as opposed to &#8220;better&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adoro</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273320</link>
		<dc:creator>Adoro</dc:creator>
		<pubDate>Tue, 05 May 2009 07:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273320</guid>
		<description>Hi

I find that this singleton better is far easier to use.

var MySingleton = new (function() {
this.public = &quot;i&#039;m public&quot;;
var private = &quot;i&#039;m private&quot;;
});

Much simpler and cleaner.  I found this on http://nortools.blogspot.com/2008/06/my-javascript-patterns.html

Cheers
Adam</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I find that this singleton better is far easier to use.</p>
<p>var MySingleton = new (function() {<br />
this.public = &#8220;i&#8217;m public&#8221;;<br />
var private = &#8220;i&#8217;m private&#8221;;<br />
});</p>
<p>Much simpler and cleaner.  I found this on <a href="http://nortools.blogspot.com/2008/06/my-javascript-patterns.html" rel="nofollow">http://nortools.blogspot.com/2008/06/my-javascript-patterns.html</a></p>
<p>Cheers<br />
Adam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lunes</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273319</link>
		<dc:creator>lunes</dc:creator>
		<pubDate>Tue, 05 May 2009 07:11:10 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273319</guid>
		<description>@DmitryBaranovskiy: Strings *have* properties (&quot;a&quot;.length) and methods (&quot;a&quot;.toUpperCase()). And JS *has* inheritance — it&#039;s just not classical inheritance but prototypical.</description>
		<content:encoded><![CDATA[<p>@DmitryBaranovskiy: Strings *have* properties (&#8220;a&#8221;.length) and methods (&#8220;a&#8221;.toUpperCase()). And JS *has* inheritance — it&#8217;s just not classical inheritance but prototypical.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sonofman</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273318</link>
		<dc:creator>sonofman</dc:creator>
		<pubDate>Tue, 05 May 2009 05:09:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273318</guid>
		<description>I love the module pattern (aka the javascript &quot;Singleton pattern&quot;).  When you honor the pledge to not clutter the global scope, you have a choice:  either package your code using the module pattern or declare every function prefixed by your namespace global.  That gets hard to read, and it makes everything public, so how then are you to know which of these functions gets called by other scripts without doing a global search on every single one of them.  Nay, the module pattern solves all the problems and is not hard to debug.  Just because Firebug doesn&#039;t display a private variable doesn&#039;t mean you can&#039;t type it in the &quot;watch&quot; field and get its value.</description>
		<content:encoded><![CDATA[<p>I love the module pattern (aka the javascript &#8220;Singleton pattern&#8221;).  When you honor the pledge to not clutter the global scope, you have a choice:  either package your code using the module pattern or declare every function prefixed by your namespace global.  That gets hard to read, and it makes everything public, so how then are you to know which of these functions gets called by other scripts without doing a global search on every single one of them.  Nay, the module pattern solves all the problems and is not hard to debug.  Just because Firebug doesn&#8217;t display a private variable doesn&#8217;t mean you can&#8217;t type it in the &#8220;watch&#8221; field and get its value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DmitryBaranovskiy</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273315</link>
		<dc:creator>DmitryBaranovskiy</dc:creator>
		<pubDate>Tue, 05 May 2009 01:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273315</guid>
		<description>@Jaxon: “Everything in JavaScript is an object” You are wrong: var a = &quot;ajax&quot;; “a” is not an object. It is a primitive string. It has no properties, no methods.
This: ParentClass.prototype = (function(){ return new Object();})(); is equal to this: ParentClass.prototype = {};
There are no private properties in JavaScript, as well as there no real inheritance in JavaScript, but you can play “pretend”.
Most of the time you can find nice JavaScript way of doing something without pseudo-inheritance.</description>
		<content:encoded><![CDATA[<p>@Jaxon: “Everything in JavaScript is an object” You are wrong: var a = &#8220;ajax&#8221;; “a” is not an object. It is a primitive string. It has no properties, no methods.<br />
This: ParentClass.prototype = (function(){ return new Object();})(); is equal to this: ParentClass.prototype = {};<br />
There are no private properties in JavaScript, as well as there no real inheritance in JavaScript, but you can play “pretend”.<br />
Most of the time you can find nice JavaScript way of doing something without pseudo-inheritance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gonchuki</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273307</link>
		<dc:creator>gonchuki</dc:creator>
		<pubDate>Mon, 04 May 2009 19:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273307</guid>
		<description>@Jaxon: that&#039;s why we have libraries like Mootools and Prototype to ease the &quot;use javascript as a classic OO language&quot; model.
.
I personally prefer to take the best of both worlds, create extensible objects/classes (with POJ/Mootools respectively) and use closures for UI management where creating a class or object is not the correct path to follow (and I say closures in general, as using the Module Pattern is not always needed for every use case).</description>
		<content:encoded><![CDATA[<p>@Jaxon: that&#8217;s why we have libraries like Mootools and Prototype to ease the &#8220;use javascript as a classic OO language&#8221; model.<br />
.<br />
I personally prefer to take the best of both worlds, create extensible objects/classes (with POJ/Mootools respectively) and use closures for UI management where creating a class or object is not the correct path to follow (and I say closures in general, as using the Module Pattern is not always needed for every use case).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cromwellian</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273299</link>
		<dc:creator>cromwellian</dc:creator>
		<pubDate>Mon, 04 May 2009 17:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273299</guid>
		<description>There is a large practical effect of having strictly enforced private fields and methods - obfuscation and dead code removal. A non-private field basically says &quot;I am publically exported, do not munge me!&quot; This means Javascript deployment tools are unable to rename the field or remove it if it can be proved inaccessible, because it&#039;s name must be assumed to be stable for late binding later (e.g. third party usage)

This may not matter for small apps, but for large Javascript applications, something like GMail or Spreadsheets, it makes a large difference.  This is one reason why GWT is so effective at creating packed code.</description>
		<content:encoded><![CDATA[<p>There is a large practical effect of having strictly enforced private fields and methods &#8211; obfuscation and dead code removal. A non-private field basically says &#8220;I am publically exported, do not munge me!&#8221; This means Javascript deployment tools are unable to rename the field or remove it if it can be proved inaccessible, because it&#8217;s name must be assumed to be stable for late binding later (e.g. third party usage)</p>
<p>This may not matter for small apps, but for large Javascript applications, something like GMail or Spreadsheets, it makes a large difference.  This is one reason why GWT is so effective at creating packed code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaxon</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273297</link>
		<dc:creator>Jaxon</dc:creator>
		<pubDate>Mon, 04 May 2009 15:26:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273297</guid>
		<description>@henrah &amp; @ilzarte:  How is enforcing strict OO data binding in prototypical inheritance fighting the language?  Everything in JavaScript is an object--Functions, Arrays, Strings, Dates, Numbers.  By using closures, it is possible to make a persistent local variable: i.e. a &quot;private&quot; variable.  Extending objects by making a new object&#039;s prototype property another object makes it possible to reuse code and properties from the parent object: a.k.a. inheritance.  Is the syntax as simple as it is in Java?  No.  But to say that using OO in JavaScript is fighting the language or that it is the wrong language for it because the syntax isn&#039;t easy is unfair.

As far as inheriting private properties and methods, one, if you have a method or property that you want to inherit, perhaps you want an &quot;intenal&quot; propety or method instead, as truly private members are only really scoped to the class and all instances of that actual class, and not children.  In order to do this you need getter methods for all the internal properties or methods you wish to inherit, and you need to use private variables in the inheriting class to set them to the prototype&#039;s inherited properties. For Example:

var ParentClass = function(){
  var inheritedMember = &#039;foo&#039;;//inherited member of a child class.
  var privateMember =&#039;bar&#039;; //private member that will not be inherited
  this.getInheritedMember = function(){return inheritedMember;};
};
ParentClass.prototype = (function(){ return new Object();})();
var ChildClass = function(){
  var inheritedMember = ChildClass.prototype.getInheritedMember();//inherits the parent member directly
  this.useInheritedMember = function(){
   alert(inheritedMember);
  }; 
}
ChildClass.prototype = (function(){return new ParentClass();})();

var test = new ChildClass();
test.useInheritedMember();

Is it easy?  No.  You have to remember the members you want to inherit for each class.  If you override an inherited member, you also have to override the getter method for that member.  If you are inheriting a large number of internal properties, the inherited members and getters can take up a lot of space.  Also, since the getters are public and JavaScript is a dynamic language, they can be overwritten at runtime.  But it is definitely doable, and keeps your internal methods and properties from being accessible outside the class structure.</description>
		<content:encoded><![CDATA[<p>@henrah &amp; @ilzarte:  How is enforcing strict OO data binding in prototypical inheritance fighting the language?  Everything in JavaScript is an object&#8211;Functions, Arrays, Strings, Dates, Numbers.  By using closures, it is possible to make a persistent local variable: i.e. a &#8220;private&#8221; variable.  Extending objects by making a new object&#8217;s prototype property another object makes it possible to reuse code and properties from the parent object: a.k.a. inheritance.  Is the syntax as simple as it is in Java?  No.  But to say that using OO in JavaScript is fighting the language or that it is the wrong language for it because the syntax isn&#8217;t easy is unfair.</p>
<p>As far as inheriting private properties and methods, one, if you have a method or property that you want to inherit, perhaps you want an &#8220;intenal&#8221; propety or method instead, as truly private members are only really scoped to the class and all instances of that actual class, and not children.  In order to do this you need getter methods for all the internal properties or methods you wish to inherit, and you need to use private variables in the inheriting class to set them to the prototype&#8217;s inherited properties. For Example:</p>
<p>var ParentClass = function(){<br />
  var inheritedMember = &#8216;foo&#8217;;//inherited member of a child class.<br />
  var privateMember =&#8217;bar&#8217;; //private member that will not be inherited<br />
  this.getInheritedMember = function(){return inheritedMember;};<br />
};<br />
ParentClass.prototype = (function(){ return new Object();})();<br />
var ChildClass = function(){<br />
  var inheritedMember = ChildClass.prototype.getInheritedMember();//inherits the parent member directly<br />
  this.useInheritedMember = function(){<br />
   alert(inheritedMember);<br />
  };<br />
}<br />
ChildClass.prototype = (function(){return new ParentClass();})();</p>
<p>var test = new ChildClass();<br />
test.useInheritedMember();</p>
<p>Is it easy?  No.  You have to remember the members you want to inherit for each class.  If you override an inherited member, you also have to override the getter method for that member.  If you are inheriting a large number of internal properties, the inherited members and getters can take up a lot of space.  Also, since the getters are public and JavaScript is a dynamic language, they can be overwritten at runtime.  But it is definitely doable, and keeps your internal methods and properties from being accessible outside the class structure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nosredna</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273296</link>
		<dc:creator>Nosredna</dc:creator>
		<pubDate>Mon, 04 May 2009 14:20:51 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273296</guid>
		<description>I don&#039;t like the module pattern. I do like making a namespace per project and making my functions be part of the namespace. My goal, always, it to have my only global be that one namespace object.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t like the module pattern. I do like making a namespace per project and making my functions be part of the namespace. My goal, always, it to have my only global be that one namespace object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: henrah</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273295</link>
		<dc:creator>henrah</dc:creator>
		<pubDate>Mon, 04 May 2009 14:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273295</guid>
		<description>One enduring criticism of the Javascript Module pattern is that it dramatically increases construction time and memory use, as every object includes a fresh copy of the instance methods, which must be created anew during initialization and then maintained in memory for the object&#039;s whole lifecycle. These aren&#039;t insurmountable problems, but they are a reminder that the semblance of member privacy in Javascript always comes at a cost.
Snook&#039;s debugging problem isn&#039;t exactly a showstopper either, but it too serves as a reminder &#8212; by enforcing strict OO data hiding, you are fighting the language and its natural constructs. It remains possible, but there are consequences.</description>
		<content:encoded><![CDATA[<p>One enduring criticism of the Javascript Module pattern is that it dramatically increases construction time and memory use, as every object includes a fresh copy of the instance methods, which must be created anew during initialization and then maintained in memory for the object&#8217;s whole lifecycle. These aren&#8217;t insurmountable problems, but they are a reminder that the semblance of member privacy in Javascript always comes at a cost.<br />
Snook&#8217;s debugging problem isn&#8217;t exactly a showstopper either, but it too serves as a reminder &mdash; by enforcing strict OO data hiding, you are fighting the language and its natural constructs. It remains possible, but there are consequences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ilazarte</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273294</link>
		<dc:creator>ilazarte</dc:creator>
		<pubDate>Mon, 04 May 2009 13:59:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273294</guid>
		<description>I&#039;m a java folk and I like it.  However, I don&#039;t use the the module pattern for classic inheritance&#039;s sake.  I use it for code organization basically.  Why would you try to do object hierarchies in Javascript?  It&#039;s simply the wrong language for it.  I get much more mileage out of js simply passing functions (some stateful, some scoped, some not) around.</description>
		<content:encoded><![CDATA[<p>I&#8217;m a java folk and I like it.  However, I don&#8217;t use the the module pattern for classic inheritance&#8217;s sake.  I use it for code organization basically.  Why would you try to do object hierarchies in Javascript?  It&#8217;s simply the wrong language for it.  I get much more mileage out of js simply passing functions (some stateful, some scoped, some not) around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/no-love-for-the-module-pattern/comment-page-1#comment-273293</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Mon, 04 May 2009 13:07:51 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6751#comment-273293</guid>
		<description>If he needs to extend, why not add a method that will do so? Have your module accept a function that it can then bind internally and expose what was passed. Problem solved. This could work for the debugging problem too if the exposed &quot;extend&quot; function can overwrite already existing methods. The purpose of the pattern is to make public, private and privileged areas, just because you can&#039;t just sit there and override that at the drop of the hat doesn&#039;t make the language unmalleable , in fact I could argue that it would make this pattern robust.</description>
		<content:encoded><![CDATA[<p>If he needs to extend, why not add a method that will do so? Have your module accept a function that it can then bind internally and expose what was passed. Problem solved. This could work for the debugging problem too if the exposed &#8220;extend&#8221; function can overwrite already existing methods. The purpose of the pattern is to make public, private and privileged areas, just because you can&#8217;t just sit there and override that at the drop of the hat doesn&#8217;t make the language unmalleable , in fact I could argue that it would make this pattern robust.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

