<?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: jQuery Plugin Design Patterns: Part I</title>
	<atom:link href="http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/feed/" rel="self" type="application/rss+xml" />
	<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/</link>
	<description></description>
	<lastBuildDate>Tue, 17 Jan 2012 16:57:58 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ZFDesign</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-5659</link>
		<dc:creator>ZFDesign</dc:creator>
		<pubDate>Tue, 20 Dec 2011 15:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-5659</guid>
		<description>Would there be a Christmas special Part 2 by any chance? Considering keeping a promise for Part 3 and 4 as mentioned in the article? It is so difficult to come across well written articles for the remaining parts that those are bound to be an immediate hit.</description>
		<content:encoded><![CDATA[<p>Would there be a Christmas special Part 2 by any chance? Considering keeping a promise for Part 3 and 4 as mentioned in the article? It is so difficult to come across well written articles for the remaining parts that those are bound to be an immediate hit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Theodor</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-5533</link>
		<dc:creator>Theodor</dc:creator>
		<pubDate>Wed, 14 Sep 2011 11:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-5533</guid>
		<description>And it is much faster to add a plugin with $.fn. than $.extend() - so, that&#039;s another reason to use the more strict way ;)</description>
		<content:encoded><![CDATA[<p>And it is much faster to add a plugin with $.fn. than $.extend() &#8211; so, that&#8217;s another reason to use the more strict way ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Chapman</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-5304</link>
		<dc:creator>Joe Chapman</dc:creator>
		<pubDate>Tue, 19 Jul 2011 14:34:29 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-5304</guid>
		<description>What a coincidence, I had just been reading this; http://2007-2010.lovemikeg.com/2009/06/26/the-factory-pattern-in-javascript/</description>
		<content:encoded><![CDATA[<p>What a coincidence, I had just been reading this; <a href="http://2007-2010.lovemikeg.com/2009/06/26/the-factory-pattern-in-javascript/" rel="nofollow">http://2007-2010.lovemikeg.com/2009/06/26/the-factory-pattern-in-javascript/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pomeh</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-5182</link>
		<dc:creator>pomeh</dc:creator>
		<pubDate>Sat, 02 Jul 2011 17:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-5182</guid>
		<description>Nice article. Thanks =)

However, I disagree about the use of the extend method. That method make the stuff, but it make very (too?) easy to add more than one method to the $.fn object. And adding more than one namespace per plugin should be avoided. This is referenced in the best practices in the Plugin Authoring (http://docs.jquery.com/Plugins/Authoring) as:
&quot;Don&#039;t clutter the jQuery.fn object with more than one namespace per plugin.&quot;

Using the &quot;$.fn.myPlugin = function(){};&quot; forces the developer to use one and only one name per plugin. Also, the Plugin Authoring describe a method to use multiples methods per plugin without pollute the $.fn namespace.</description>
		<content:encoded><![CDATA[<p>Nice article. Thanks =)</p>
<p>However, I disagree about the use of the extend method. That method make the stuff, but it make very (too?) easy to add more than one method to the $.fn object. And adding more than one namespace per plugin should be avoided. This is referenced in the best practices in the Plugin Authoring (<a href="http://docs.jquery.com/Plugins/Authoring" rel="nofollow">http://docs.jquery.com/Plugins/Authoring</a>) as:<br />
&#8220;Don&#8217;t clutter the jQuery.fn object with more than one namespace per plugin.&#8221;</p>
<p>Using the &#8220;$.fn.myPlugin = function(){};&#8221; forces the developer to use one and only one name per plugin. Also, the Plugin Authoring describe a method to use multiples methods per plugin without pollute the $.fn namespace.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomislav Simić</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-4802</link>
		<dc:creator>Tomislav Simić</dc:creator>
		<pubDate>Tue, 11 Jan 2011 11:40:20 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-4802</guid>
		<description>I&#039;ve been wandering for a few days searching for concise usable info like in this articke. It is really missing rest of the series as it feels like it would be of a great help to jq-plugin-dev-newborn.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been wandering for a few days searching for concise usable info like in this articke. It is really missing rest of the series as it feels like it would be of a great help to jq-plugin-dev-newborn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-4382</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Sat, 13 Nov 2010 20:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-4382</guid>
		<description>Great article! Neatly solves the problem of maintaining state.

Will there be a Part 2 Doug?</description>
		<content:encoded><![CDATA[<p>Great article! Neatly solves the problem of maintaining state.</p>
<p>Will there be a Part 2 Doug?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Spryn</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-2617</link>
		<dc:creator>Bob Spryn</dc:creator>
		<pubDate>Wed, 02 Jun 2010 21:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-2617</guid>
		<description>Part 2 coming?</description>
		<content:encoded><![CDATA[<p>Part 2 coming?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christoph</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-2127</link>
		<dc:creator>Christoph</dc:creator>
		<pubDate>Wed, 14 Apr 2010 15:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-2127</guid>
		<description>Looking forward to Part 2!!!</description>
		<content:encoded><![CDATA[<p>Looking forward to Part 2!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-2052</link>
		<dc:creator>Kris</dc:creator>
		<pubDate>Thu, 01 Apr 2010 13:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-2052</guid>
		<description>Part &#124;&#124; Please</description>
		<content:encoded><![CDATA[<p>Part || Please</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1972</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Wed, 10 Mar 2010 15:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1972</guid>
		<description>Hi, really nice discussion! I&#039;m actually stuck in creating something like the rating widget you described wherein it maintain it&#039;s own data ...is there any chance you can explain further especially how jquery ui is designed to allow something like updating it&#039;s option..  

$(&#039;.selector&#039;).button(&#039;option&#039;, &#039;text&#039;, false);</description>
		<content:encoded><![CDATA[<p>Hi, really nice discussion! I&#8217;m actually stuck in creating something like the rating widget you described wherein it maintain it&#8217;s own data &#8230;is there any chance you can explain further especially how jquery ui is designed to allow something like updating it&#8217;s option..  </p>
<p>$(&#8217;.selector&#8217;).button(&#8217;option&#8217;, &#8216;text&#8217;, false);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: This Weeks Twitter Design News Roundup N.21 - Speckyboy Design Magazine</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1751</link>
		<dc:creator>This Weeks Twitter Design News Roundup N.21 - Speckyboy Design Magazine</dc:creator>
		<pubDate>Tue, 26 Jan 2010 08:57:55 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1751</guid>
		<description>[...] jQuery Plugin Design Patterns: Part I [...]</description>
		<content:encoded><![CDATA[<p>[...] jQuery Plugin Design Patterns: Part I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Linkhub &#8211; Woche 04-2010 &#171; pehbehbeh</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1740</link>
		<dc:creator>Linkhub &#8211; Woche 04-2010 &#171; pehbehbeh</dc:creator>
		<pubDate>Sun, 24 Jan 2010 16:52:06 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1740</guid>
		<description>[...] Wie sollten jQuery Plugins aussehen? &#8211; Auf Fuel Your Coding wurde eine Artikelserie zu jQuery Plugins Design Patterns gestartet. [...]</description>
		<content:encoded><![CDATA[<p>[...] Wie sollten jQuery Plugins aussehen? &#8211; Auf Fuel Your Coding wurde eine Artikelserie zu jQuery Plugins Design Patterns gestartet. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sanakan</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1725</link>
		<dc:creator>sanakan</dc:creator>
		<pubDate>Fri, 22 Jan 2010 18:30:14 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1725</guid>
		<description>When using Widget Factory, Could I use Mootools(or  Prototype) to creat the Class ,then using jQuery  &quot;data()&quot;  its object ,manipulating  DOM ? I like the OO concept ,also like the jQuery dom magic.</description>
		<content:encoded><![CDATA[<p>When using Widget Factory, Could I use Mootools(or  Prototype) to creat the Class ,then using jQuery  &#8220;data()&#8221;  its object ,manipulating  DOM ? I like the OO concept ,also like the jQuery dom magic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas Neiner</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1719</link>
		<dc:creator>Douglas Neiner</dc:creator>
		<pubDate>Thu, 21 Jan 2010 17:25:23 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1719</guid>
		<description>I have favorited that SO article now. I will throw my two cents in when I get a moment :) Thanks for pointing it out!</description>
		<content:encoded><![CDATA[<p>I have favorited that SO article now. I will throw my two cents in when I get a moment :) Thanks for pointing it out!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas Neiner</title>
		<link>http://fuelyourcoding.com/jquery-plugin-design-patterns-part-i/comment-page-1/#comment-1718</link>
		<dc:creator>Douglas Neiner</dc:creator>
		<pubDate>Thu, 21 Jan 2010 17:23:08 +0000</pubDate>
		<guid isPermaLink="false">http://fuelyourcoding.com/?p=798#comment-1718</guid>
		<description>James, I always appreciate when you stop over and discus our posts here! 

First, you are totally right, it is $.fn.extend. I have updated the post to reflect that.

As far as the &quot;class and function&quot; approach, we haven&#039;t gotten to the true interaction with it yet. However, it is the design pattern employed by jQuery UI for their widgets. If you instantiate a `dialog` for instance, then call `$(&quot;#dialog&quot;).data(&#039;dialog&#039;)` you can retrieve the instance of the Widget class for the dialog. 

A good use case I had for it was a rating system. There were 20 rating widgets, who all maintained their own state independently of the others. However, I also had a ScoreKeeper of sorts that listened for &quot;rating_changed&quot; events on the Rating widgets, and then would access each of the widgets using (through a wrapper) the `data(&#039;RatingWidget&#039;)` and tally up the total. 

This method allows you to build fully independent objects that can interact with each other as needed. By exposing the Class behind the object via `data` you allow your widget to be extended or manipulated by other widgets on the page. Of course you can use standard closures to limit what is available on the object. When `.remove()` is called all the `data` is removed from the element.

Back to jQuery UI, as a final example, when you call `.dialog(&#039;open&#039;)` it is actually finding the instance via `data` then applying the function to that instance behind the scenes. You can check it out starting at line 284 in ui.core.js (1.7.2).</description>
		<content:encoded><![CDATA[<p>James, I always appreciate when you stop over and discus our posts here! </p>
<p>First, you are totally right, it is $.fn.extend. I have updated the post to reflect that.</p>
<p>As far as the &#8220;class and function&#8221; approach, we haven&#8217;t gotten to the true interaction with it yet. However, it is the design pattern employed by jQuery UI for their widgets. If you instantiate a `dialog` for instance, then call `$(&#8221;#dialog&#8221;).data(&#8217;dialog&#8217;)` you can retrieve the instance of the Widget class for the dialog. </p>
<p>A good use case I had for it was a rating system. There were 20 rating widgets, who all maintained their own state independently of the others. However, I also had a ScoreKeeper of sorts that listened for &#8220;rating_changed&#8221; events on the Rating widgets, and then would access each of the widgets using (through a wrapper) the `data(&#8217;RatingWidget&#8217;)` and tally up the total. </p>
<p>This method allows you to build fully independent objects that can interact with each other as needed. By exposing the Class behind the object via `data` you allow your widget to be extended or manipulated by other widgets on the page. Of course you can use standard closures to limit what is available on the object. When `.remove()` is called all the `data` is removed from the element.</p>
<p>Back to jQuery UI, as a final example, when you call `.dialog(&#8217;open&#8217;)` it is actually finding the instance via `data` then applying the function to that instance behind the scenes. You can check it out starting at line 284 in ui.core.js (1.7.2).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

