<?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: If you use an &#8216;if&#8217; you deserve to suffer</title>
	<atom:link href="http://www.markhneedham.com/blog/2008/10/21/if-you-use-an-if-you-deserve-to-suffer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2008/10/21/if-you-use-an-if-you-deserve-to-suffer/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: The Punch Barrel by Frank Carver / If you use an ‘if’ you deserve to suffer</title>
		<link>http://www.markhneedham.com/blog/2008/10/21/if-you-use-an-if-you-deserve-to-suffer/comment-page-1/#comment-896</link>
		<dc:creator>The Punch Barrel by Frank Carver / If you use an ‘if’ you deserve to suffer</dc:creator>
		<pubDate>Fri, 24 Oct 2008 08:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=515#comment-896</guid>
		<description>[...] If you use an ‘if’ you deserve to suffer at Mark Needham [...]</description>
		<content:encoded><![CDATA[<p>[...] If you use an ‘if’ you deserve to suffer at Mark Needham [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah Taraporewalla</title>
		<link>http://www.markhneedham.com/blog/2008/10/21/if-you-use-an-if-you-deserve-to-suffer/comment-page-1/#comment-839</link>
		<dc:creator>Sarah Taraporewalla</dc:creator>
		<pubDate>Tue, 21 Oct 2008 06:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=515#comment-839</guid>
		<description>...until you use a &#039;real&#039; language like python or ruby that is, were brackets are frowned upon. Your first example is correct in python, because the indentation level is identical. ahhh.....languages that a pretty as well as smart.</description>
		<content:encoded><![CDATA[<p>&#8230;until you use a &#8216;real&#8217; language like python or ruby that is, were brackets are frowned upon. Your first example is correct in python, because the indentation level is identical. ahhh&#8230;..languages that a pretty as well as smart.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris Kemper</title>
		<link>http://www.markhneedham.com/blog/2008/10/21/if-you-use-an-if-you-deserve-to-suffer/comment-page-1/#comment-834</link>
		<dc:creator>Kris Kemper</dc:creator>
		<pubDate>Tue, 21 Oct 2008 02:57:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=515#comment-834</guid>
		<description>Use braces. Developers love leaving them out, but I find that it constantly results in developers forgetting them when adding a second condition. While the loss in time is often small, say a few minutes to figure it out on average, those situations can be avoided by just putting them in. Every little bit helps, and can add up to a lot.

Also, I feel like you didn&#039;t pursue the concept of removing if&#039;s from a codebase entirely. As mentioned by the blog in the link you mentioned, if&#039;s that decide based on type are a clear smell for some polymorphism.

On the other hand, there is a line where a simple if statement introduces less complexity than a pattern to get around it. I&#039;ve worked with developers that when they see an if statement, they say &quot;Hey, you can avoid that with a strategy pattern.&quot; While that may make sense in some cases, in others, it&#039;s going to result in the creation of a new object hierarchy, and only one code location that uses this forced polymorphic approach. Sometimes, you just can&#039;t beat a simple if statement.</description>
		<content:encoded><![CDATA[<p>Use braces. Developers love leaving them out, but I find that it constantly results in developers forgetting them when adding a second condition. While the loss in time is often small, say a few minutes to figure it out on average, those situations can be avoided by just putting them in. Every little bit helps, and can add up to a lot.</p>
<p>Also, I feel like you didn&#8217;t pursue the concept of removing if&#8217;s from a codebase entirely. As mentioned by the blog in the link you mentioned, if&#8217;s that decide based on type are a clear smell for some polymorphism.</p>
<p>On the other hand, there is a line where a simple if statement introduces less complexity than a pattern to get around it. I&#8217;ve worked with developers that when they see an if statement, they say &#8220;Hey, you can avoid that with a strategy pattern.&#8221; While that may make sense in some cases, in others, it&#8217;s going to result in the creation of a new object hierarchy, and only one code location that uses this forced polymorphic approach. Sometimes, you just can&#8217;t beat a simple if statement.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

