<?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: &#8220;Prototypal chainability&#8221;</title>
	<atom:link href="http://james.padolsey.com/javascript/prototypal-chainability/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.padolsey.com/javascript/prototypal-chainability/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 02 Feb 2012 18:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Matthew</title>
		<link>http://james.padolsey.com/javascript/prototypal-chainability/comment-page-1/#comment-9930</link>
		<dc:creator>Matthew</dc:creator>
		<pubDate>Tue, 14 Apr 2009 20:15:28 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=741#comment-9930</guid>
		<description>(I suggest &#039;method call chaining&#039;. Or yeah, builder pattern.</description>
		<content:encoded><![CDATA[<p>(I suggest &#8216;method call chaining&#8217;. Or yeah, builder pattern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew</title>
		<link>http://james.padolsey.com/javascript/prototypal-chainability/comment-page-1/#comment-9929</link>
		<dc:creator>Matthew</dc:creator>
		<pubDate>Tue, 14 Apr 2009 20:14:50 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=741#comment-9929</guid>
		<description>To be clear: this doesn&#039;t really have much to do with prototype-based OO or chaining of prototypes in javascript.

It&#039;s just a convention that can be used in any OO language where you &#039;return this&#039; from methods.

Probably best not to name the technique in a way that leads to confusion with javascript&#039;s prototype-chain-based object attribute lookup semantics.</description>
		<content:encoded><![CDATA[<p>To be clear: this doesn&#8217;t really have much to do with prototype-based OO or chaining of prototypes in javascript.</p>
<p>It&#8217;s just a convention that can be used in any OO language where you &#8216;return this&#8217; from methods.</p>
<p>Probably best not to name the technique in a way that leads to confusion with javascript&#8217;s prototype-chain-based object attribute lookup semantics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SaturnPolly</title>
		<link>http://james.padolsey.com/javascript/prototypal-chainability/comment-page-1/#comment-9901</link>
		<dc:creator>SaturnPolly</dc:creator>
		<pubDate>Tue, 14 Apr 2009 12:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=741#comment-9901</guid>
		<description>In the context of object creation this is also called builder pattern. Here is an example from Effective Java (2nd Edition):

&lt;pre lang=&quot;java&quot;&gt;NutritionFacts sodaDrink = new NutritionFacts.Builder(240, 8).calories(100).sodium(35).carbohydrate(27).build();&lt;/pre&gt;

see http://www.javaspecialists.eu/archive/Issue163.html for more details, they talk about some of the chapters in this book.

I find it irritating to use the terms &#039;prototypal&#039; or &#039;inheritence&#039; though, since neither is really involved in this approach.</description>
		<content:encoded><![CDATA[<p>In the context of object creation this is also called builder pattern. Here is an example from Effective Java (2nd Edition):</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">NutritionFacts sodaDrink <span class="sy0">=</span> <span class="kw1">new</span> NutritionFacts.<span class="me1">Builder</span><span class="br0">&#40;</span><span class="nu0">240</span>, <span class="nu0">8</span><span class="br0">&#41;</span>.<span class="me1">calories</span><span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>.<span class="me1">sodium</span><span class="br0">&#40;</span><span class="nu0">35</span><span class="br0">&#41;</span>.<span class="me1">carbohydrate</span><span class="br0">&#40;</span><span class="nu0">27</span><span class="br0">&#41;</span>.<span class="me1">build</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>

<p>see <a href="http://www.javaspecialists.eu/archive/Issue163.html">http://www.javaspecialists.eu/archive/Issue163.html</a> for more details, they talk about some of the chapters in this book.</p>
<p>I find it irritating to use the terms &#8216;prototypal&#8217; or &#8216;inheritence&#8217; though, since neither is really involved in this approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham B</title>
		<link>http://james.padolsey.com/javascript/prototypal-chainability/comment-page-1/#comment-9872</link>
		<dc:creator>Graham B</dc:creator>
		<pubDate>Mon, 13 Apr 2009 13:38:39 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=741#comment-9872</guid>
		<description>Chaining is a great technique if you like your scripts concise.

Just a small addition; one thing chains can&#039;t do is give you returned data, as the returned object must always be the original instance. One way around this is to allow an optional callback parameter, so your method can return some data about the instance while invoking a new &#039;chain&#039;. Admittedly its not pretty and I don&#039;t do it myself, but it works if you &lt;i&gt;really&lt;/i&gt; must do everything on one line.</description>
		<content:encoded><![CDATA[<p>Chaining is a great technique if you like your scripts concise.</p>
<p>Just a small addition; one thing chains can&#8217;t do is give you returned data, as the returned object must always be the original instance. One way around this is to allow an optional callback parameter, so your method can return some data about the instance while invoking a new &#8216;chain&#8217;. Admittedly its not pretty and I don&#8217;t do it myself, but it works if you <i>really</i> must do everything on one line.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

