<?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: Object.too_clever_by_half? rescue nil</title>
	<atom:link href="http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/</link>
	<description>rails, ruby, supercollider, dsp</description>
	<pubDate>Fri, 05 Sep 2008 18:50:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Reg Braithwaite</title>
		<link>http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/#comment-5</link>
		<dc:creator>Reg Braithwaite</dc:creator>
		<pubDate>Mon, 07 Apr 2008 22:33:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.trapdoor1.net/?p=15#comment-5</guid>
		<description>Robin:

Well, in all fairness to KISS, what if a project suffers "The death of a thousand hacks"? IOW, Maybe #andand looks like a good idea. And so does #let (http://ick.rubyforge.org). And so does Symbol#to_proc. And so does X and Y and Z.

On a case-by-case basis, each may seem like a very good idea that has a positive ROI, is worth the time to learn.

But taken in aggregate, the code may be incomprehensible without serious study to learn each "idiom."

I don't know the answer to that one, it's a legitimate problem.</description>
		<content:encoded><![CDATA[<p>Robin:</p>
<p>Well, in all fairness to KISS, what if a project suffers &#8220;The death of a thousand hacks&#8221;? IOW, Maybe #andand looks like a good idea. And so does #let (http://ick.rubyforge.org). And so does Symbol#to_proc. And so does X and Y and Z.</p>
<p>On a case-by-case basis, each may seem like a very good idea that has a positive ROI, is worth the time to learn.</p>
<p>But taken in aggregate, the code may be incomprehensible without serious study to learn each &#8220;idiom.&#8221;</p>
<p>I don&#8217;t know the answer to that one, it&#8217;s a legitimate problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robin</title>
		<link>http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/#comment-4</link>
		<dc:creator>robin</dc:creator>
		<pubDate>Mon, 07 Apr 2008 08:52:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.trapdoor1.net/?p=15#comment-4</guid>
		<description>Reg, point taken - I wrote the list of links giving a broad overview. And then wrote the rest of the post, which went in a slightly different direction.

#andand isn't a good example to have there.</description>
		<content:encoded><![CDATA[<p>Reg, point taken - I wrote the list of links giving a broad overview. And then wrote the rest of the post, which went in a slightly different direction.</p>
<p>#andand isn&#8217;t a good example to have there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Welker</title>
		<link>http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/#comment-3</link>
		<dc:creator>Eddie Welker</dc:creator>
		<pubDate>Sun, 06 Apr 2008 03:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.trapdoor1.net/?p=15#comment-3</guid>
		<description>I agree with Reg, it does seem to me that #andand is trying to be both DRY and KISS.  To use it or not... it simply depends on the audience.  If you're at a ruby-familiar place, and understand what modifying Object means, that's fine.

I work with a ton of bright people but I'd feel guilty using it (despite liking it), because I would know I'd slow down the next guy when he read it. 

It's all just a case of various levels of compromise, and over an idiom at that.</description>
		<content:encoded><![CDATA[<p>I agree with Reg, it does seem to me that #andand is trying to be both DRY and KISS.  To use it or not&#8230; it simply depends on the audience.  If you&#8217;re at a ruby-familiar place, and understand what modifying Object means, that&#8217;s fine.</p>
<p>I work with a ton of bright people but I&#8217;d feel guilty using it (despite liking it), because I would know I&#8217;d slow down the next guy when he read it. </p>
<p>It&#8217;s all just a case of various levels of compromise, and over an idiom at that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reg Braithwaite</title>
		<link>http://blog.trapdoor1.net/2008/04/05/object-too_clever_by_half-rescue-nil/#comment-2</link>
		<dc:creator>Reg Braithwaite</dc:creator>
		<pubDate>Sun, 06 Apr 2008 00:06:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.trapdoor1.net/?p=15#comment-2</guid>
		<description>First, I'm not sure why you mention Object#andand in the same breath as SafeNil. The former does not modify any exiting methods in either Object or in NilClass.

Second, I am confused by the example you give. There is NOTHING wrong with writing @person.name unless @person.nil?. The documentation for #andand specifically agrees  with you. This is because looking up @person is cheap and free of side effects.

Whereas, if you needed to do something expensive and/or something with side effects, you would have to manufacture an instance variable to memoize your operation.

The choice I face is when to write:

begin
  temp_person = Person.find(...)
  temp_person.name if temp_person
end

And when to write:

Person.find(...).andand.name

I am all for the former if you prefer it, if you find it easier to read or aunderstand, and if the idea of adding the method #andand to the Object class keeps you up late at night. It is much less invasive than changing the behaviour of NilClass, but if it's too much for you on principle, I have no problem with that.

But let's be clear on the use case. @person.name unless @person.nil is NOT the use case.

Finally, I cannot answer for anyone else. But I do think that for me, DRY is KISS. If you think Object#andand makes the code less simple, than I agree you should eschew it. But it is not intended to be a tool for making things DRY at the expense of KISS, it is inteded to make things DRY and simpler.</description>
		<content:encoded><![CDATA[<p>First, I&#8217;m not sure why you mention Object#andand in the same breath as SafeNil. The former does not modify any exiting methods in either Object or in NilClass.</p>
<p>Second, I am confused by the example you give. There is NOTHING wrong with writing @person.name unless @person.nil?. The documentation for #andand specifically agrees  with you. This is because looking up @person is cheap and free of side effects.</p>
<p>Whereas, if you needed to do something expensive and/or something with side effects, you would have to manufacture an instance variable to memoize your operation.</p>
<p>The choice I face is when to write:</p>
<p>begin<br />
  temp_person = Person.find(&#8230;)<br />
  temp_person.name if temp_person<br />
end</p>
<p>And when to write:</p>
<p>Person.find(&#8230;).andand.name</p>
<p>I am all for the former if you prefer it, if you find it easier to read or aunderstand, and if the idea of adding the method #andand to the Object class keeps you up late at night. It is much less invasive than changing the behaviour of NilClass, but if it&#8217;s too much for you on principle, I have no problem with that.</p>
<p>But let&#8217;s be clear on the use case. @person.name unless @person.nil is NOT the use case.</p>
<p>Finally, I cannot answer for anyone else. But I do think that for me, DRY is KISS. If you think Object#andand makes the code less simple, than I agree you should eschew it. But it is not intended to be a tool for making things DRY at the expense of KISS, it is inteded to make things DRY and simpler.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
