<?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: Helpful JavaScript Design Patterns</title>
	<atom:link href="http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/</link>
	<description>Application Performance Management</description>
	<lastBuildDate>Tue, 18 Jun 2013 20:00:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Link Dump &#8211; November 23, 2012 Edition &#124; Wern Ancheta</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-10750</link>
		<dc:creator>Link Dump &#8211; November 23, 2012 Edition &#124; Wern Ancheta</dc:creator>
		<pubDate>Fri, 23 Nov 2012 13:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-10750</guid>
		<description><![CDATA[[...] SourceURL: http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SourceURL: http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/ [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Meine Lesezeichen vom 27 September bis 12 Oktober : Casa Rock!</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-10426</link>
		<dc:creator>Meine Lesezeichen vom 27 September bis 12 Oktober : Casa Rock!</dc:creator>
		<pubDate>Thu, 15 Nov 2012 21:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-10426</guid>
		<description><![CDATA[[...] Helpful JavaScript Patterns &#124; New Relic blog [Tags: tips patterns javascript ] [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Helpful JavaScript Patterns | New Relic blog [Tags: tips patterns javascript ] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Morrow</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-9879</link>
		<dc:creator>David Morrow</dc:creator>
		<pubDate>Tue, 06 Nov 2012 23:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-9879</guid>
		<description><![CDATA[thanks for the update, 
I like your pattern very much. I think the phrase &quot;dependency injection&quot; sums up what makes it so appealing. 

Thanks for sharing this, this will make it into my snippets.]]></description>
		<content:encoded><![CDATA[<p>thanks for the update,<br />
I like your pattern very much. I think the phrase &#8220;dependency injection&#8221; sums up what makes it so appealing. </p>
<p>Thanks for sharing this, this will make it into my snippets.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-9314</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Mon, 22 Oct 2012 14:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-9314</guid>
		<description><![CDATA[Sure thing, a simple example without using libraries may look generally like this:

&lt;code&gt;
window.MyApp = (window.MyApp &#124;&#124; {});

MyApp.MyUtils = (function() {
	return {
		doHandyThing1: function() {},
		doHandyThing2 function() {}
	};
}());

MyApp.MyModule = (function( utils ) {
	
	var privateValue = &quot;Encapsulated value. No one else can touch this.&quot;;
	
	var ModuleExport = function() {
		// Do constructor stuff.
		utils.doHandyThing1(); // &lt;&lt; Take advantage of imported utilities!
	};
	
	ModuleExport.prototype = {
		publicValue: &quot;Anyone can change this.&quot;,
		publicMethod: function() {
			// Anyone can call this.
		},
		getEncapsulatedValue: function() {
			// Anyone can call this to GET the encapsulated value.
			// However, nothing else can SET the encapsulated value.
			return privateValue;
		}
	};

	// Export a single instance of our module:
	return new ModuleExport();

}( MyApp.MyUtils ));
&lt;/code&gt;

The key concept here that differs from your proposed module pattern is inversion of control: MyUtils and MyModule are two separate modules, and therefore, neither should be aware of each other within the application superstructure. While we could technically reference &quot;MyApp.MyUtils.doHandyThing1&quot; from within MyModule, this violates the rule of modules being self-contained and ignorant of what&#039;s outside of them. To loosely couple this relationship, MyApp.MyUtils is provided once in the MyModule scope invocation (final line of code), at which time it becomes available as a local variable within the MyModule scope. This relationship of dependency injection enforces encapsulation, keeping modules easier to manage and test. Frameworks such as Require.js are designed to automate this loosely coupled dependency management.]]></description>
		<content:encoded><![CDATA[<p>Sure thing, a simple example without using libraries may look generally like this:</p>
<p><code><br />
window.MyApp = (window.MyApp || {});</p>
<p>MyApp.MyUtils = (function() {<br />
	return {<br />
		doHandyThing1: function() {},<br />
		doHandyThing2 function() {}<br />
	};<br />
}());</p>
<p>MyApp.MyModule = (function( utils ) {</p>
<p>	var privateValue = "Encapsulated value. No one else can touch this.";</p>
<p>	var ModuleExport = function() {<br />
		// Do constructor stuff.<br />
		utils.doHandyThing1(); // &lt;&lt; Take advantage of imported utilities!<br />
	};</p>
<p>	ModuleExport.prototype = {<br />
		publicValue: &quot;Anyone can change this.&quot;,<br />
		publicMethod: function() {<br />
			// Anyone can call this.<br />
		},<br />
		getEncapsulatedValue: function() {<br />
			// Anyone can call this to GET the encapsulated value.<br />
			// However, nothing else can SET the encapsulated value.<br />
			return privateValue;<br />
		}<br />
	};</p>
<p>	// Export a single instance of our module:<br />
	return new ModuleExport();</p>
<p>}( MyApp.MyUtils ));<br />
</code></p>
<p>The key concept here that differs from your proposed module pattern is inversion of control: MyUtils and MyModule are two separate modules, and therefore, neither should be aware of each other within the application superstructure. While we could technically reference &#8220;MyApp.MyUtils.doHandyThing1&#8243; from within MyModule, this violates the rule of modules being self-contained and ignorant of what&#8217;s outside of them. To loosely couple this relationship, MyApp.MyUtils is provided once in the MyModule scope invocation (final line of code), at which time it becomes available as a local variable within the MyModule scope. This relationship of dependency injection enforces encapsulation, keeping modules easier to manage and test. Frameworks such as Require.js are designed to automate this loosely coupled dependency management.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Morrow</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-9071</link>
		<dc:creator>David Morrow</dc:creator>
		<pubDate>Tue, 16 Oct 2012 15:52:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-9071</guid>
		<description><![CDATA[Thanks for your comments.
The above patterns i shared on the post are simply patterns i find myself using often that work well for many situations.
I&#039;d love to see a gist of the pattern you are referencing, and I could possibly comment on it or even learn something myself.
- Dave]]></description>
		<content:encoded><![CDATA[<p>Thanks for your comments.<br />
The above patterns i shared on the post are simply patterns i find myself using often that work well for many situations.<br />
I&#8217;d love to see a gist of the pattern you are referencing, and I could possibly comment on it or even learn something myself.<br />
- Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-9022</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Mon, 15 Oct 2012 00:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-9022</guid>
		<description><![CDATA[With all due respect to your definition of the module pattern; it seems incomplete as you portray it. Mind you, the term &quot;module&quot; is ambiguous, and therefore somewhat speculative. While your implementation publishes an object with a public API and encapsulated internals, both of which are important aspects of modularity, I don&#039;t feel that in and of itself solves the greater goals of object relationship management, wherein we&#039;d like to loosely-couple object references through inversion of control. Publishing modules to static URIs within a namespace tree forces them to look outside their factory scope to make references to other components, which cements application architecture and defeats encapsulation. The result begins to feel suspiciously like traditional speghetti code within a fancier wrapper. I&#039;d argue that true modularity takes this a step further by completely encapsulating a component&#039;s behavior from all out-of-scope references (window being of of them), in favor of loosely-coupled references made through dependency injection. Modular frameworks such as Require.js take this to the extreme by cometely eliminating the need for application namespace through its dependency manager.]]></description>
		<content:encoded><![CDATA[<p>With all due respect to your definition of the module pattern; it seems incomplete as you portray it. Mind you, the term &#8220;module&#8221; is ambiguous, and therefore somewhat speculative. While your implementation publishes an object with a public API and encapsulated internals, both of which are important aspects of modularity, I don&#8217;t feel that in and of itself solves the greater goals of object relationship management, wherein we&#8217;d like to loosely-couple object references through inversion of control. Publishing modules to static URIs within a namespace tree forces them to look outside their factory scope to make references to other components, which cements application architecture and defeats encapsulation. The result begins to feel suspiciously like traditional speghetti code within a fancier wrapper. I&#8217;d argue that true modularity takes this a step further by completely encapsulating a component&#8217;s behavior from all out-of-scope references (window being of of them), in favor of loosely-coupled references made through dependency injection. Modular frameworks such as Require.js take this to the extreme by cometely eliminating the need for application namespace through its dependency manager.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-8978</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Sat, 13 Oct 2012 08:41:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-8978</guid>
		<description><![CDATA[Unless I&#039;m missing something, this won&#039;t allow you to create multiple instances of MyClass using new, which is what David&#039;s second pattern achieves?]]></description>
		<content:encoded><![CDATA[<p>Unless I&#8217;m missing something, this won&#8217;t allow you to create multiple instances of MyClass using new, which is what David&#8217;s second pattern achieves?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kyb</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-8926</link>
		<dc:creator>kyb</dc:creator>
		<pubDate>Fri, 12 Oct 2012 13:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-8926</guid>
		<description><![CDATA[I prefer using this style, but it doesn&#039;t play well with the jsdoc-toolkit.]]></description>
		<content:encoded><![CDATA[<p>I prefer using this style, but it doesn&#8217;t play well with the jsdoc-toolkit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tuzemec</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-8921</link>
		<dc:creator>tuzemec</dc:creator>
		<pubDate>Fri, 12 Oct 2012 12:40:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-8921</guid>
		<description><![CDATA[Stoyan is at Facebook now. :-)
And yep, the book is really good.]]></description>
		<content:encoded><![CDATA[<p>Stoyan is at Facebook now. <img src='http://blog.newrelic.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
And yep, the book is really good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://blog.newrelic.com/2012/10/09/helpful-javascript-patterns/#comment-8903</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Fri, 12 Oct 2012 09:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.newrelic.com/?p=11686#comment-8903</guid>
		<description><![CDATA[Also try qbaka.net to monitor JavaScript errors that users experience in production.]]></description>
		<content:encoded><![CDATA[<p>Also try qbaka.net to monitor JavaScript errors that users experience in production.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
