<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: Marick's Law</title>
    <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Marick's Law</title>
      <description>&lt;p&gt;A month ago I was deep in the throes of shipping the current release of FitNesse.  I just wanted to get it done.  I was close to delivery when I spotted a subtle flaw.  To fix this flaw I decided to insert identical &lt;code&gt;if&lt;/code&gt; statements into each of 9 implementations of an abstract function.&lt;/p&gt;


	&lt;p&gt;My &lt;a href="http://butunclebob.com/ArticleS.UncleBob.GreenWristBand"&gt;green wrist band&lt;/a&gt; was glowing a nasty shade of puke.  I knew I was duplicating code.  I knew that I should use the Template Method pattern.  But that just seemed too &lt;em&gt;hard&lt;/em&gt;. I was convinced that it would be faster to spew the duplicated code out into the derivatives, get the release done, and then clean it up later.&lt;/p&gt;


	&lt;p&gt;So this morning I was doing something else, and I spotted this duplicated code.  I sighed, as I looked down at my &lt;a href="http://butunclebob.com/ArticleS.UncleBob.GreenWristBand"&gt;green wrist band&lt;/a&gt;, and thought to myself that I&amp;#8217;d better eat my own dog food and clean this mess up before it gets any worse.  I was dreading it.&lt;/p&gt;


	&lt;p&gt;I made sure that every occurrence of the statement was identical.  Then I went to the base class with the intention of refactoring a Template Method.  When, what to my wondering eyes should appear, but a Template Method that was already there.&lt;/p&gt;


	&lt;p&gt;I sheepishly copied and pasted the &lt;code&gt;if&lt;/code&gt; statement from one of the derivatives into the Template Method, and then deleted the other eight instances.&lt;/p&gt;


	&lt;p&gt;I ran the tests.&lt;/p&gt;


	&lt;p&gt;They all passed.&lt;/p&gt;


	&lt;p&gt;Damn.&lt;/p&gt;


	&lt;p&gt;My &lt;a href="http://butunclebob.com/ArticleS.UncleBob.GreenWristBand"&gt;green wrist band&lt;/a&gt; is shouting: &amp;#8220;I &lt;span class="caps"&gt;TOLD YOU SO&lt;/span&gt;!&amp;#8221;&lt;/p&gt;


	&lt;p&gt;For my penance I did 20 recitations of Marick&amp;#8217;s law.  &amp;#8220;When it comes to code it &lt;em&gt;never&lt;/em&gt; pays to rush.&amp;#8221;&lt;/p&gt;</description>
      <pubDate>Sat, 29 Nov 2008 14:12:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:438f5dd8-2a4d-4f02-955f-4c48cdf69bec</guid>
      <author>Uncle Bob</author>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder</link>
      <category>Uncle Bob's Blatherings</category>
      <category>Clean Code</category>
    </item>
    <item>
      <title>"Marick's Law" by jewellery</title>
      <description>&lt;p&gt;ah ha you can have a yrt&lt;/p&gt;</description>
      <pubDate>Tue, 22 Jun 2010 04:25:19 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:651a3330-f08a-4698-816b-cc46488f2708</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-13432</link>
    </item>
    <item>
      <title>"Marick's Law" by ipad video converter</title>
      <description>&lt;p&gt;ah ha 
you can have a yrt&lt;/p&gt;</description>
      <pubDate>Mon, 19 Apr 2010 22:12:16 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:67076906-3ce2-4951-b2b4-4e67fdf9b21f</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-10201</link>
    </item>
    <item>
      <title>"Marick's Law" by Kooba Handbags   </title>
      <description>&lt;p&gt;Living without an aim is like sailing without a compass.
with a new &lt;a href="http://www.handbags4buy.com/" rel="nofollow"&gt;http://www.handbags4buy.com/&lt;/a&gt; idea is a crank until the idea succeeds.&lt;/p&gt;</description>
      <pubDate>Thu, 01 Apr 2010 01:10:26 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:19852f55-3e9a-42b2-92da-60474ed238d8</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-8979</link>
    </item>
    <item>
      <title>"Marick's Law" by worker compensation lawyers</title>
      <description>&lt;p&gt;Hi..thanks for the information&amp;#8230; loved it simply Oh man! What an amazing thing to say&lt;/p&gt;</description>
      <pubDate>Tue, 24 Nov 2009 13:17:27 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:d201f015-4334-4601-944c-120011d5496b</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-5295</link>
    </item>
    <item>
      <title>"Marick's Law" by family lawyers sydney</title>
      <description>&lt;p&gt;can you give more&lt;/p&gt;</description>
      <pubDate>Thu, 12 Nov 2009 12:28:18 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:0ed91969-3d62-4ab1-be06-b7e925c88065</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-5104</link>
    </item>
    <item>
      <title>"Marick's Law" by ed hardy</title>
      <description>&lt;p&gt;So much harder to slack off with others watching &amp;#8230;..&lt;/p&gt;</description>
      <pubDate>Mon, 28 Sep 2009 10:33:55 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e1662ad4-e14b-4715-80dc-9695c8d411ac</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-4283</link>
    </item>
    <item>
      <title>"Marick's Law" by DinnerwarE</title>
      <description>&lt;p&gt;Oh i agree on that, rushing code always puts us in trouble! But i did not know about these green wrist band and i just love them, i&amp;#8217;ll send a donation and will get a few for the office, it&amp;#8217;s a funny reminder that can really get helpfull!&lt;/p&gt;</description>
      <pubDate>Fri, 11 Sep 2009 12:41:36 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:4446fe5d-9e7f-459b-bcb0-c8525125fbae</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-4040</link>
    </item>
    <item>
      <title>"Marick's Law" by Bret Pettichord</title>
      <description>&lt;p&gt;And a raspberry when it sees us doing too much cut n paste.&lt;/p&gt;</description>
      <pubDate>Fri, 06 Mar 2009 14:59:49 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:57da9aa1-f7c7-4338-a0b9-a6a7f2ba1c96</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-2883</link>
    </item>
    <item>
      <title>"Marick's Law" by Mike Finney</title>
      <description>&lt;p&gt;Hmmm.  Perhaps we should make a plug-in for our IDE which has a little character applauding when it recognizes a refactoring we did.  :)   Perhaps a nice sound. (Ding!)&lt;/p&gt;</description>
      <pubDate>Sat, 29 Nov 2008 15:57:26 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:6a5c9187-7c16-4eaa-91b2-cab3583a465a</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-2240</link>
    </item>
    <item>
      <title>"Marick's Law" by llewellyn falco</title>
      <description>&lt;p&gt;I agree with this, but I have to  say that pairing makes it easier to implement. So much harder to slack off with others watching&lt;/p&gt;</description>
      <pubDate>Sat, 29 Nov 2008 15:31:59 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:e4d3cece-2376-422e-9c21-03271e4ca524</guid>
      <link>http://blog.objectmentor.com/articles/2008/11/29/discipline-reminder#comment-2239</link>
    </item>
  </channel>
</rss>
