<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Perilled &#187; Programming</title>
	<atom:link href="http://perilled.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://perilled.com</link>
	<description>Blog of Erik St. Martin (Ruby Hacker &#38; Psychology Enthusiast)</description>
	<lastBuildDate>Thu, 23 Feb 2012 20:18:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fallacies of the Software Developer I (Sunk Cost)</title>
		<link>http://perilled.com/2012/02/22/fallacies-of-the-software-developer-i-sunk-cost/</link>
		<comments>http://perilled.com/2012/02/22/fallacies-of-the-software-developer-i-sunk-cost/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 04:26:27 +0000</pubDate>
		<dc:creator>Erik St. Martin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Psychology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fallacies]]></category>
		<category><![CDATA[physcology]]></category>

		<guid isPermaLink="false">http://perilled.com/?p=211</guid>
		<description><![CDATA[Wow, hard to believe 2 years have passed since I have posted here, I think it&#8217;s time to kick things back into gear now that I have more free time. Many people who know me, are aware that psychology is a big hobby of mine, the way people interact, the decisions they make and why they [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, hard to believe 2 years have passed since I have posted here, I think it&#8217;s time to kick things back into gear now that I have more free time. Many people who know me, are aware that psychology is a big hobby of mine, the way people interact, the decisions they make and why they make them is extremely intriguing. This article will be the start of a long series of articles regarding the psychology of a programmers daily decision making process.</p>
<p>The topic of discussion today is fallacies that effect programmers on a day to day basis, also referred to as &#8220;cognitive biases&#8221;.  A quick look on wikipedia yields us this useful description:</p>
<blockquote><p>A <a title="Cognitive bias" href="http://en.wikipedia.org/wiki/Cognitive_bias">cognitive bias</a> describes a replicable pattern in perceptual distortion, inaccurate judgment, illogical interpretation, or what is broadly called <a title="Irrationality" href="http://en.wikipedia.org/wiki/Irrationality">irrationality</a>. They are the result of distortions in the human mind that always lead to the same pattern of poor judgment, often triggered by a particular situation.</p></blockquote>
<p>What does this mean? It means due to emotional irrationality you are prone to make poor judgements and decisions based on previous experiences even if the opposite outcome is better for you in the long run. Even a specific way a question is worded can make you choose opposite choices.</p>
<p>The first fallacy i&#8217;m going to talk about is the &#8220;Sunk Cost Fallacy&#8221;. I&#8217;m going to quote <a title="Peter Michaud" href="http://www.petermichaud.com/essays/sunk-cost-fallacy/">Peter  Michaud</a>&#8216;s post here because I really like his description</p>
<blockquote><p>Sunk Costs are costs which have already been incurred and cannot be recovered. The <strong>Sunk Cost Fallacy</strong> is a mistake in reasoning in which you consider the sunk costs of an activity (instead of the <em>future</em>costs) when you decide whether you should continue the activity or not.</p></blockquote>
<p>As developers we experience this problem every day while coding, the language our app is written in, libraries we are using, a particular design pattern or architecture we have chosen to use. Deep down we know this is not healthy for the maintainability of our app down the road, but yet we find it hard to scrap it and start fresh. Why is this? It all boils down to loss aversion.</p>
<blockquote><p><strong>loss aversion</strong> refers to people&#8217;s tendency to strongly prefer avoiding losses to acquiring gains. Some studies suggest that losses are twice as powerful, psychologically, as gains.</p></blockquote>
<p>You see, although refactoring, or rewriting all together seems like it may be a lot of work, even though we know it&#8217;s ultimately best. It&#8217;s not the idea of that work that chooses us to continue painfully stuck in our old decisions. It&#8217;s the pain of feeling like all the time, money and resources spent on the old implementation was a complete waste, by changing to something different we have to accept the fact that we threw away all of that, it was worthless, or was it?</p>
<p>I really love some of the examples on <a title="You Are Not So Smart" href="http://youarenotsosmart.com/2011/03/25/the-sunk-cost-fallacy/">You Are Not So Smart</a>&#8216;s article. It talks a lot about how the sunk cost fallacy and loss aversion keeps games like Farmville thriving. It&#8217;s worth the read if you can spare the extra couple of minutes. I&#8217;m going to quote an example from the article.</p>
<blockquote><p>If you dropped your cell phone over the edge of a cruise ship, you would need James Cameron’s unmanned submarine fleet to find it again. Sure, you could spend a small fortune to retrieve it, but you wouldn’t throw good money after bad. Laid out like this, logical and rational and easy to pick apart, you can pat yourself on the back for being such a reasonable human. Unfortunately, the sunk costs in life aren’t always so easy to see. When something is gone forever it can be difficult to realize it. The past isn’t as tangible a concept as the sea floor, yet it is just as untouchable. What is left behind is just as irretrievable.</p></blockquote>
<p>He&#8217;s right, in a situation like this the answer is clear, it&#8217;s gone, move on, but when it comes to the things we hold more dear and slaved over the decision becomes clouded.</p>
<p>But let&#8217;s really think about this, you replace your car every so many years, you replace warn clothes, shoes and many other things. You paid money for them, and sometimes quite a bit, but when they&#8217;ve seen their day it&#8217;s time to move on.</p>
<p>I&#8217;d advise that we keep this into consideration when we are deciding to deprecate whatever library, language, framework, or implementation that is no longer as usefull as it once was and is just causing more work and pain to keep stable and maintainable, just because we may feel that we wasted time and resources. The time is gone already, irretrievable. You will never get it back, and you will never get back the time you continue to poor into something that is just no longer useful.</p>
<p>The fact is that it was useful for a period of time, it served it&#8217;s purpose well. Pat yourself on the back for that, and then pat yourself on the back for the next rendition of it. Your time was not wasted, remember that. You performed a task to get your app to what it is today, and it was the best choice at the moment, but make sure to consider if it is still the best choice moving forward, or if it&#8217;s just going to cause you more greif than anything.</p>
<p>The past is irrelevant in this particular decision. What matters most is what is best for your future as well as the app / codebase. Choosing a new direction does not mean that the old choice was a bad one. It was a learning experience and something to grow on. Growing out of something is a good thing. Your users evolve, the company evolves, it grows, it adapts, and so should the code base. Your employer would not stay in the same building they invested 2 years in, and lots of money if they needed more space to accomodate all the new hires. You shouldn&#8217;t stay with the same technology decisions if the direction of your app is changing either. It served it&#8217;s purpose for the time being, and it was great. What&#8217;s next?</p>
]]></content:encoded>
			<wfw:commentRss>http://perilled.com/2012/02/22/fallacies-of-the-software-developer-i-sunk-cost/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5 Tips for Writing Good Comments</title>
		<link>http://perilled.com/2008/06/24/5-tips-for-writing-good-comments/</link>
		<comments>http://perilled.com/2008/06/24/5-tips-for-writing-good-comments/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 16:51:34 +0000</pubDate>
		<dc:creator>Erik St. Martin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://perilled.com/?p=18</guid>
		<description><![CDATA[There are probably as many theories on proper commenting of your code as there are developers writing the code. What is worth noting? what is not? I think to much focus is wrapped up in rules that make writing good comments confusing to new and seasoned developers alike. I will go over a few simple [...]]]></description>
			<content:encoded><![CDATA[<p>There are probably as many theories on proper commenting of your code as there are developers writing the code. What is worth noting? what is not? I think to much focus is wrapped up in rules that make writing good comments confusing to new and seasoned developers alike. I will go over a few simple rules I like to stand by.</p>
<p><strong>1) Use XDoc comments wherever applicable.</strong> There are a number of tools out there that will make your life a lot easier when generating base documentation and HTML versions of your API documentation. They are quite useful.</p>
<p><strong>2) Don&#8217;t comment just to comment. </strong>Quantity is not better than quality in most situations and this one is no exception. To many comments can be distracting and take you away from what is important; <em>The code</em>.</p>
<p><strong>3) Answer the write question.</strong> To many times I read comments that always answer the question <em>&#8220;What?&#8221;</em> . If you can not easily read your code and determine what its doing you may want to consider addressing the problem a different way. There are a few exceptions to this rule with complex algorithms and methods, but you should use comments that answer this question minimally. The real question that should be answered is<em> &#8220;Why?&#8221;</em>. 6 months or 2 years down the road when you open up the code its probably going to be fairly obvious what the code is doing, what will not be so obvious is why you did something that particular way, some business based rule that was determined in a meeting that made sense at the time, is now just a big question mark. You will thank yourself when you don&#8217;t have to rewrite something just to figure out there was a reason you had done it that way.</p>
<p><strong>4) Use examples. </strong>Even the best documentation and comments can leave confusion to people not as familiar with the code as you are. Be sure to include small snippets of code demonstrating how to use a class or method that you have created if there may be room for confusion.</p>
<p><strong>5) Don&#8217;t be afraid of humor. </strong>Hunting down defects or just implementing a new feature can be long and tedious at times. At 3am when you or a fellow developer are knee deep in code you&#8217;ll appreciate the laugh it will remind you how much fun coding is.</p>
]]></content:encoded>
			<wfw:commentRss>http://perilled.com/2008/06/24/5-tips-for-writing-good-comments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

