<?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"
	>
<channel>
	<title>Comments on: YUI&#8217;s &#8220;Module Pattern&#8221; vs. Prototype&#8217;s Class Function</title>
	<atom:link href="http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/</link>
	<description>Isaac Schlueter on Web Development</description>
	<pubDate>Mon, 12 May 2008 01:02:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Isaac</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-631</link>
		<dc:creator>Isaac</dc:creator>
		<pubDate>Thu, 01 May 2008 08:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-631</guid>
		<description>That's a very good point.

In all fairness to Prototype, I haven't used it nearly as extensively as I have YUI, and it does provide some very nifty syntactic sugar.  What's worse, I personally know a lot of the people involved with YUI, and I'm sure that my high opinion of them as people colors my feelings about their work, even if I try my best to be unbiased.

However, I *can* say that I've interviewed and known with many Javascript developers who have worked with Prototype and Dojo.  Take away their $, and most of them are useless.  We internalize the paradigms we surround ourselves with.  By comparison, I've also seen complete javascript novices (including a few non-yahoos) start using YUI, and by adopting the paradigms in the library, become much better javascripters.

The fundamental reason for this is obvious: YUI was created with the intent of extending the paradigms within the javascript language.  Most other libraries were created with the intent of changing the paradigms of the language.  You can't learn russian by speaking french.

There comes a time in a project, hopefully as soon as possible, when you pick a framework and run with it.  That decision is never fully informed, because that would make it pointless.  The quality of the community and the documentation is key.  In my opinion, YUI is a better library largely because it fosters a community that tends to be more knowledgeable about javascript in general, and because code that uses YUI will tend to be more understandable by anyone who knows Javascript.

Dojo's chaining syntax is pretty and clever, but if you aren't familiar with Dojo, it can be rather confusing.  On the other hand, YUI's structures, and the code that implements them, while a bit more wordy than Dojo, are also very clear, easy to optimize, and easy for any javascripter to understand, even if they're not already familiar with YUI.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a very good point.</p>
<p>In all fairness to Prototype, I haven&#8217;t used it nearly as extensively as I have YUI, and it does provide some very nifty syntactic sugar.  What&#8217;s worse, I personally know a lot of the people involved with YUI, and I&#8217;m sure that my high opinion of them as people colors my feelings about their work, even if I try my best to be unbiased.</p>
<p>However, I *can* say that I&#8217;ve interviewed and known with many Javascript developers who have worked with Prototype and Dojo.  Take away their $, and most of them are useless.  We internalize the paradigms we surround ourselves with.  By comparison, I&#8217;ve also seen complete javascript novices (including a few non-yahoos) start using YUI, and by adopting the paradigms in the library, become much better javascripters.</p>
<p>The fundamental reason for this is obvious: YUI was created with the intent of extending the paradigms within the javascript language.  Most other libraries were created with the intent of changing the paradigms of the language.  You can&#8217;t learn russian by speaking french.</p>
<p>There comes a time in a project, hopefully as soon as possible, when you pick a framework and run with it.  That decision is never fully informed, because that would make it pointless.  The quality of the community and the documentation is key.  In my opinion, YUI is a better library largely because it fosters a community that tends to be more knowledgeable about javascript in general, and because code that uses YUI will tend to be more understandable by anyone who knows Javascript.</p>
<p>Dojo&#8217;s chaining syntax is pretty and clever, but if you aren&#8217;t familiar with Dojo, it can be rather confusing.  On the other hand, YUI&#8217;s structures, and the code that implements them, while a bit more wordy than Dojo, are also very clear, easy to optimize, and easy for any javascripter to understand, even if they&#8217;re not already familiar with YUI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-627</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Sun, 27 Apr 2008 09:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-627</guid>
		<description>To properly compare frameworks and libraries one must become very proficient in each library.  That means write several applications in each.  Or, more fairly, write the same application in each.  Perhaps the old Pet Store.

By the time you're done the libraries will have evolved and the critics will say you're using out-of-date software.  Then, of course, you will have used up far more time than you have available, and a major purpose for using the library was saving time in the first place!

Rational comparison is irrationally expensive.

Fred</description>
		<content:encoded><![CDATA[<p>To properly compare frameworks and libraries one must become very proficient in each library.  That means write several applications in each.  Or, more fairly, write the same application in each.  Perhaps the old Pet Store.</p>
<p>By the time you&#8217;re done the libraries will have evolved and the critics will say you&#8217;re using out-of-date software.  Then, of course, you will have used up far more time than you have available, and a major purpose for using the library was saving time in the first place!</p>
<p>Rational comparison is irrationally expensive.</p>
<p>Fred</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-180</link>
		<dc:creator>Isaac</dc:creator>
		<pubDate>Sun, 18 Nov 2007 19:36:23 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-180</guid>
		<description>@Animal

That works just as well, I suppose, except that the private methods can't be accessed from within the constructor itself.  On the other hand, the benefit is that, for those familiar with the javascript module pattern, it uses the module pattern to create the prototype.

Of course, they're so cheap that when in doubt, I just create a closure to hide code within it.  They you can afford to be a bit "sloppy" (creating vars willy-nilly) without fear of polluting the global space.</description>
		<content:encoded><![CDATA[<p>@Animal</p>
<p>That works just as well, I suppose, except that the private methods can&#8217;t be accessed from within the constructor itself.  On the other hand, the benefit is that, for those familiar with the javascript module pattern, it uses the module pattern to create the prototype.</p>
<p>Of course, they&#8217;re so cheap that when in doubt, I just create a closure to hide code within it.  They you can afford to be a bit &#8220;sloppy&#8221; (creating vars willy-nilly) without fear of polluting the global space.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Animal</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-179</link>
		<dc:creator>Animal</dc:creator>
		<pubDate>Sun, 18 Nov 2007 09:48:16 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-179</guid>
		<description>I don't see the point of creating the constructor in the anonymous function. If the public instance methods (in the prototype) need to use private (inaccessible to others) variables, just have the *prototype* returned from an anonymous function:

&lt;code class="block javascript"&gt;MyClass= function(a, b, id) {
};&lt;br /&gt;
MyClass.prototype = (function() {
&#160;&#160;var privateData = "foo";
&#160;&#160;function privateMethod() {
&#160;&#160;};
&#160;&#160;return {
&#160;&#160;&#160;&#160;publicMethod: function()  {}
&#160;&#160;};
})();&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I don&#8217;t see the point of creating the constructor in the anonymous function. If the public instance methods (in the prototype) need to use private (inaccessible to others) variables, just have the *prototype* returned from an anonymous function:</p>
<p><code class="block javascript">MyClass= function(a, b, id) {<br />
};<br />
MyClass.prototype = (function() {<br />
&nbsp;&nbsp;var privateData = &#8220;foo&#8221;;<br />
&nbsp;&nbsp;function privateMethod() {<br />
&nbsp;&nbsp;};<br />
&nbsp;&nbsp;return {<br />
&nbsp;&nbsp;&nbsp;&nbsp;publicMethod: function()  {}<br />
&nbsp;&nbsp;};<br />
})();</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Foo Hack &#187; Blueprint CSS Framework vs YUI Grids</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-46</link>
		<dc:creator>Foo Hack &#187; Blueprint CSS Framework vs YUI Grids</dc:creator>
		<pubDate>Mon, 27 Aug 2007 17:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-46</guid>
		<description>[...] did recently compare YUI with a competitor, and I don&#8217;t want this to turn into a &#8220;YUI vs. X&#8221; blog. It&#8217;s a very limited [...]</description>
		<content:encoded><![CDATA[<p>[...] did recently compare YUI with a competitor, and I don&#8217;t want this to turn into a &#8220;YUI vs. X&#8221; blog. It&#8217;s a very limited [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denis</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-43</link>
		<dc:creator>Denis</dc:creator>
		<pubDate>Fri, 24 Aug 2007 02:35:23 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-43</guid>
		<description>Take a look at jGrouse Loader http://jgrouse.com/#jgrouselib/jgloader.html - it is the logical extension and implementation for the concept of JavaScript module. Normally you would expect that modules would track dependencies on each other and have a predictable initialization order - jGrouse Loader provides that functionality. And you can use it with any other library that you're currently using.</description>
		<content:encoded><![CDATA[<p>Take a look at jGrouse Loader <a href="http://jgrouse.com/#jgrouselib/jgloader.html" rel="nofollow" class="external">http://jgrouse.com/#jgrouselib/jgloader.html</a> - it is the logical extension and implementation for the concept of JavaScript module. Normally you would expect that modules would track dependencies on each other and have a predictable initialization order - jGrouse Loader provides that functionality. And you can use it with any other library that you&#8217;re currently using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-39</link>
		<dc:creator>Isaac</dc:creator>
		<pubDate>Mon, 13 Aug 2007 23:06:21 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-39</guid>
		<description>Thanks for the props, guys.

@Nate I think I just figured out a promotion technique for Foohack: write about YUI every other post, and let you promote it for me. :)</description>
		<content:encoded><![CDATA[<p>Thanks for the props, guys.</p>
<p>@Nate I think I just figured out a promotion technique for Foohack: write about YUI every other post, and let you promote it for me. <img src='http://foohack.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate Koechley</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-38</link>
		<dc:creator>Nate Koechley</dc:creator>
		<pubDate>Mon, 13 Aug 2007 20:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-38</guid>
		<description>Well said - I'll be pointing people to this post for sure.

Thanks,
Nate</description>
		<content:encoded><![CDATA[<p>Well said - I&#8217;ll be pointing people to this post for sure.</p>
<p>Thanks,<br />
Nate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt snider</title>
		<link>http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-37</link>
		<dc:creator>matt snider</dc:creator>
		<pubDate>Mon, 13 Aug 2007 19:03:48 +0000</pubDate>
		<guid isPermaLink="false">http://foohack.com/2007/08/yui-crockford-module-pattern-vs-prototypes-class-function/#comment-37</guid>
		<description>Great post Isaac. I could not agree more ^_^</description>
		<content:encoded><![CDATA[<p>Great post Isaac. I could not agree more ^_^</p>
]]></content:encoded>
	</item>
</channel>
</rss>
