<?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: DRYing Up respond_to</title>
	<atom:link href="http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/feed" rel="self" type="application/rss+xml" />
	<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:19:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<item>
		<title>By: K. Adam Christensen</title>
		<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/comment-page-1#comment-250</link>
		<dc:creator>K. Adam Christensen</dc:creator>
		<pubDate>Sun, 18 Jan 2009 18:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://dev.fecalrod.com/?p=19#comment-250</guid>
		<description>Going back and taking a good look at this, yeah...this should not be used.</description>
		<content:encoded><![CDATA[<p>Going back and taking a good look at this, yeah&#8230;this should not be used.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacob Atzen</title>
		<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/comment-page-1#comment-36</link>
		<dc:creator>Jacob Atzen</dc:creator>
		<pubDate>Wed, 29 Nov 2006 11:25:11 +0000</pubDate>
		<guid isPermaLink="false">http://dev.fecalrod.com/?p=19#comment-36</guid>
		<description>&lt;p&gt;Adam,&lt;/p&gt;

&lt;p&gt;I can see where you&#039;re coming from - I have had the same thoughts. Doing those respond_to blocks over and over again does not seem very dry to me. I was thinking about doing something even cleaner. Say you have a method like:&lt;/p&gt;

&lt;pre&gt;
def index
  @articles = Article.find(:all)
end
&lt;/pre&gt;
&lt;p&gt;Now if the user wants HTML this would work like in the old days. If the user wants xml on the other hand Rails would automatically call @articles.to_xml. If the user wants csv... you get the picture. The idea being that the return value of the function would automatically get the correct method called.&lt;/p&gt;
&lt;p&gt;
I&#039;m not sure this idea is good though as I haven&#039;t really used respond_to or REST much yet. Perhaps the actions will become too different in real applications for this to actually make sense. But from the outset it does seem there&#039;s quite a lot of repetition.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Adam,</p>
<p>I can see where you&#8217;re coming from &#8211; I have had the same thoughts. Doing those respond_to blocks over and over again does not seem very dry to me. I was thinking about doing something even cleaner. Say you have a method like:</p>
<pre>
def index
  @articles = Article.find(:all)
end
</pre>
<p>Now if the user wants HTML this would work like in the old days. If the user wants xml on the other hand Rails would automatically call @articles.to_xml. If the user wants csv&#8230; you get the picture. The idea being that the return value of the function would automatically get the correct method called.</p>
<p>
I&#8217;m not sure this idea is good though as I haven&#8217;t really used respond_to or REST much yet. Perhaps the actions will become too different in real applications for this to actually make sense. But from the outset it does seem there&#8217;s quite a lot of repetition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amr Malik</title>
		<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/comment-page-1#comment-35</link>
		<dc:creator>Amr Malik</dc:creator>
		<pubDate>Mon, 27 Nov 2006 11:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://dev.fecalrod.com/?p=19#comment-35</guid>
		<description>Not knocking your approach Adam, but personally, I think the vanilla rails methodology is more obvious. I think DRY is good, but not at the cost of readability or maintainability. Those terms are subjective, but to me the proposed approach seems a bit more confusing than just typing the extra text. Maybe I&#039;m looking at it from an outsider&#039;s perspective.

cheers.

-Amr</description>
		<content:encoded><![CDATA[<p>Not knocking your approach Adam, but personally, I think the vanilla rails methodology is more obvious. I think DRY is good, but not at the cost of readability or maintainability. Those terms are subjective, but to me the proposed approach seems a bit more confusing than just typing the extra text. Maybe I&#8217;m looking at it from an outsider&#8217;s perspective.</p>
<p>cheers.</p>
<p>-Amr</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/comment-page-1#comment-34</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Mon, 27 Nov 2006 10:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://dev.fecalrod.com/?p=19#comment-34</guid>
		<description>Truth be told, it wasn&#039;t pain but curiosity that led me to do this.  I wanted to do some more metaprogramming as an exercise, and I learned a lot from doing this.  The code to make this all work is somewhat dark-magic, but you can find many examples of dark-magic though-out the rails source.

Sorry you&#039;re not a fan, although I can see your point about it being less readable.</description>
		<content:encoded><![CDATA[<p>Truth be told, it wasn&#8217;t pain but curiosity that led me to do this.  I wanted to do some more metaprogramming as an exercise, and I learned a lot from doing this.  The code to make this all work is somewhat dark-magic, but you can find many examples of dark-magic though-out the rails source.</p>
<p>Sorry you&#8217;re not a fan, although I can see your point about it being less readable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alain Ravet</title>
		<link>http://shifteleven.com/articles/2006/11/26/drying-up-respond_to/comment-page-1#comment-33</link>
		<dc:creator>Alain Ravet</dc:creator>
		<pubDate>Mon, 27 Nov 2006 00:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://dev.fecalrod.com/?p=19#comment-33</guid>
		<description>Yuk.

I can&#039;t understand you felt such a pain with the clean and standard Rails code that it made you jump through so many oops, to finally end up with much less readable/obvious code.

Please don&#039;t make a plugin.</description>
		<content:encoded><![CDATA[<p>Yuk.</p>
<p>I can&#8217;t understand you felt such a pain with the clean and standard Rails code that it made you jump through so many oops, to finally end up with much less readable/obvious code.</p>
<p>Please don&#8217;t make a plugin.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
