<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>chris clarke</title>
	<link>http://squadlimber.com/chris</link>
	<description>software development that works...or something</description>
	<pubDate>Mon, 07 Apr 2008 23:14:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>Ignoring Common Coding Practice (why you should be too)</title>
		<link>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/</link>
		<comments>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 00:13:48 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Refactoring</category>

		<category>eXtreme Programming</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/</guid>
		<description><![CDATA[Simon Baker wrote a quick blog entry on Common Sense and Common Practice.  It hit home with me because recently I&#8217;ve been pairing with developers who find it uncomfortable coding in certain ways because it doesn&#8217;t fit with Common Practice.  A lot of code I see, whether it be reading a programming book, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.agileinaction.com/">Simon Baker</a> wrote a quick blog entry on <a href="http://www.think-box.co.uk/blog/2008/01/common.html">Common Sense and Common Practice</a>.  It hit home with me because recently I&#8217;ve been pairing with developers who find it uncomfortable coding in certain ways because it doesn&#8217;t fit with Common Practice.  A lot of code I see, whether it be reading a programming book, looking at some code I Googled, or looking back at the way I was taught at University, is really just a bit rubbish in my opinion.  It works okay, and I&#8217;m sure a computer can understand it, but as a human I find myself struggling a bit.  Typically the code seems to be telling me <strong><em>how</em></strong> the computation is taking place rather than <strong><em>what</em></strong> it is doing.  Sure, you need some <strong><em>how</em></strong> code but put it behind a little <strong><em>what</em></strong> code and give me a chance.</p>
<p>Anyway, enough passive-aggressive blogging, here are some things that people tend to find uncomfortable and perhaps why they shouldn&#8217;t:</p>
<h3>Long names</h3>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; @Test <span style="color: #000080;">public</span> <span style="color: #000080;">void</span> findingXMLElementByNameThrowsExceptionWhenElementDoesNotExist<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">String</span></a> someXmlWithNoFrankTag = <span style="color: #008000;">&quot;...&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ADocument+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">Document</span></a> xmlDocument = XmlUtils.<span style="color: #000000;">toDocument</span><span style="color: #000000;">&#40;</span>someXmlWithNoFrankTag<span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">try</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlUtils.<span style="color: #000000;">findElementByName</span><span style="color: #000000;">&#40;</span>xmlDocument, <span style="color: #008000;">&quot;frank&quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fail<span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Expected exception to be thrown because the element 'frank' does not exist!&quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #000080;">catch</span> <span style="color: #000000;">&#40;</span>JDOMException expectedBecauseElementShouldNotBeFound<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>Long descriptive names seem uncomfortable to people because you don&#8217;t normally see them in Common Practice.  I think they help because it&#8217;s much easier to see what&#8217;s going on without looking in to the details of the languages implementation and its easier to find code that already does what you want.</p>
<h3>Extracting composed methods that don&#8217;t remove duplication</h3>
<p>Before:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">void</span> somebodyCheckedIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CheckIn checkIn : codeCheckIns<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;christopherc&quot;</span>.<span style="color: #000000;">equals</span><span style="color: #000000;">&#40;</span>checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// update web page</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printTitle</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Code changed by: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printHeader</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;On date: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">date</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printBold</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Changes: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CodeChange codeChange : checkIn.<span style="color: #000000;">codeChanges</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;File &quot;</span>&nbsp; &nbsp;codeChange.<span style="color: #000000;">fileName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&nbsp; &nbsp;<span style="color: #008000;">&quot;: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Diff: &quot;</span>&nbsp; &nbsp;PrettyDiffFormatter.<span style="color: #000000;">format</span><span style="color: #000000;">&#40;</span>codeChange.<span style="color: #000000;">diff</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// kick off build</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span>builder.<span style="color: #000000;">isRunning</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">emptyBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">addToBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000080;">new</span> Build<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>After:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">void</span> somebodyCheckedIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CheckIn checkIn : codeCheckIns<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;christopherc&quot;</span>.<span style="color: #000000;">equals</span><span style="color: #000000;">&#40;</span>checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateWebPageWithCheckIn<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stopTheBuildIfItsRunningAndBuild<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #000080;">private</span> <span style="color: #000080;">void</span> updateWebPageWithCheckIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; page.<span style="color: #000000;">printTitle</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Code changed by: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; page.<span style="color: #000000;">printHeader</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;On date: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">date</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; page.<span style="color: #000000;">printBold</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Changes: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CodeChange codeChange : checkIn.<span style="color: #000000;">codeChanges</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;File &quot;</span>&nbsp; &nbsp;codeChange.<span style="color: #000000;">fileName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&nbsp; &nbsp;<span style="color: #008000;">&quot;: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Diff: &quot;</span>&nbsp; &nbsp;PrettyDiffFormatter.<span style="color: #000000;">format</span><span style="color: #000000;">&#40;</span>codeChange.<span style="color: #000000;">diff</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #000080;">private</span> <span style="color: #000080;">void</span> stopTheBuildIfItsRunningAndBuild<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span>builder.<span style="color: #000000;">isRunning</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">emptyBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">addToBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000080;">new</span> Build<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>People seem a bit uncomfortable with this refactoring because they think it doesn&#8217;t achieve anything except adding more code.  Sure, no duplication has been removed but its now much clearer what the public method does without having to look in to the imperative details of how it does it in the private methods.  I can now understand this code at a glance after splitting out the two things that were happening inside the loop and as an added benefit I was able to remove some comments by naming the methods well.</p>
<h3>Creating classes to express your domain</h3>
<p><a href="http://ivan.truemesh.com/">Ivan Moore</a> and <a href="http://peripateticaxiom.blogspot.com/">Keith Braithwaite</a> ran a workshop at <a href="http://www.spaconference.org/">SPA 2008</a> on <a href="http://ivan.truemesh.com/archives/000733.html">Programming as if the domain mattered</a> which inspired me on this one.</p>
<p>For example, if you are writing a Banking application, you can create classes that express familiar language in Banking.</p>
<p>Without domain classes:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">String</span></a> customer = <span style="color: #008000;">&quot;Mr Clarke&quot;</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">long</span> custId = <span style="color: #0000ff;">234234555</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">double</span> amount = <span style="color: #0000ff;">500.0</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">double</span> interest = <span style="color: #0000ff;">1.055</span>;<br />
&nbsp; &nbsp; Account account = <span style="color: #000080;">new</span> Account<span style="color: #000000;">&#40;</span>customer, custId, <span style="color: #000080;">null</span>, <span style="color: #000080;">null</span>, <span style="color: #0000ff;">0.0</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">setAmount</span><span style="color: #000000;">&#40;</span>amount * interest<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; database.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span>account<span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
<p>With domain classes:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; Customer customer = <span style="color: #000080;">new</span> Customer<span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Mr Clarke&quot;</span>, <span style="color: #0000ff;">234234555</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Money money = <span style="color: #000080;">new</span> Money<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">500.0</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Interest interest = <span style="color: #000080;">new</span> Interest<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">5.5</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Account account = customer.<span style="color: #000000;">openAccount</span><span style="color: #000000;">&#40;</span>money<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">addInterest</span><span style="color: #000000;">&#40;</span>interest<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; database.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span>account<span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
<p>I&#8217;ve found people are put off by this domain language because a lot of the classes involved don&#8217;t achieve much, you&#8217;ll have to imagine a lot of them for yourself but for example the Money class could start life as pretty much a wrapper around a primitive:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">class</span> Money <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">private</span> <span style="color: #000080;">double</span> amount;<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">public</span> Money <span style="color: #000000;">&#40;</span><span style="color: #000080;">double</span> amount<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">this</span>.<span style="color: #000000;">amount</span> = amount;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span><br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>Another argument against is that it increases memory footprint - and hey if that&#8217;s really really (come on is it really?) important to you then just use primitives.</p>
<h3>Be Brave</h3>
<p>I wish people would be a bit braver and use the code to express what they are trying to do and not worry about whether the way they are doing it is against Common Practice.  Remember, the majority of software projects are still failures, so why follow Common Practice - it isn&#8217;t working!</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting your TODOs out of comments</title>
		<link>http://squadlimber.com/chris/2007/06/08/73/</link>
		<comments>http://squadlimber.com/chris/2007/06/08/73/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 22:12:26 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Refactoring</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/06/08/73/</guid>
		<description><![CDATA[Thoughtworker Carlos Villela talks about Getting your TODOs out of comments.
Genius.

]]></description>
			<content:encoded><![CDATA[<p>Thoughtworker Carlos Villela talks about <a href="http://www.lixo.org/archives/2007/06/06/tip-get-your-todos-out-of-the-comments/">Getting your TODOs out of comments</a>.</p>
<p>Genius.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/06/08/73/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Red, Green, Cup of Tea</title>
		<link>http://squadlimber.com/chris/2007/05/02/red-green-cup-of-tea/</link>
		<comments>http://squadlimber.com/chris/2007/05/02/red-green-cup-of-tea/#comments</comments>
		<pubDate>Wed, 02 May 2007 20:55:23 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Continuous Integration</category>

		<category>Testing</category>

		<category>Refactoring</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/05/02/red-green-cup-of-tea/</guid>
		<description><![CDATA[I like the Red Green Refactor pattern - write a failing test, make the test go green and then refactor the code.  However, I&#8217;ve found recently that refactor doesn&#8217;t necessarily mean make the code tidier or improve the design to some people.  To some people it just means change some existing code.  [...]]]></description>
			<content:encoded><![CDATA[<p>I like the <a href="http://www.jamesshore.com/Blog/Red-Green-Refactor.html">Red Green Refactor</a> pattern - write a failing test, make the test go green and then refactor the code.  However, I&#8217;ve found recently that refactor doesn&#8217;t necessarily mean <em>make the code tidier</em> or <em>improve the design</em> to some people.  To some people it just means <em>change some existing code</em>.  <img id="image64" src="http://squadlimber.com/chris/wp-content/uploads/2007/05/cup_of_tea.jpg" alt="cup_of_tea.jpg" align="right"/>  </p>
<p>So I invented (by accident) the Red Green Cup of Tea pattern - write a failing test, make the test go green, and go and make a cup of tea whilst the build runs.  I&#8217;ve found that whilst making a cup of tea, my pair and I can reflect on what we&#8217;ve just done and often find we weren&#8217;t 100% happy with what we just did.  We then set our cups of tea back down on the desk and <a href="http://c2.com/cgi/wiki?WhatIsRefactoring">Refactor</a> the code.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/05/02/red-green-cup-of-tea/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
