<?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>let x=x &#187; rewrite</title>
	<atom:link href="http://www.crazymcphee.net/x/tag/rewrite/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Fri, 27 Jan 2012 09:36:24 +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>Throw it away and write another one</title>
		<link>http://www.crazymcphee.net/x/2010/05/30/throw-it-away-and-write-another-one/</link>
		<comments>http://www.crazymcphee.net/x/2010/05/30/throw-it-away-and-write-another-one/#comments</comments>
		<pubDate>Sun, 30 May 2010 08:47:10 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[professional practice]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ANTLR]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[emergent design]]></category>
		<category><![CDATA[profession]]></category>
		<category><![CDATA[refactor]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[test driven design]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=557</guid>
		<description><![CDATA[Most developers familiar with agile methods are familiar with the idea of the spike. A spike is a time-boxed task that concentrates on clarifying the unknowns in your project. Usually these are technological (&#8220;can this be done with this technology?&#8221;) but they are also sometimes in the area of the business domain (&#8220;is this a [...]]]></description>
			<content:encoded><![CDATA[<p>Most developers familiar with agile methods are familiar with the idea of the <em>spike</em>. A spike is a time-boxed task that concentrates on clarifying the unknowns in your project. Usually these are technological (&#8220;can this be done with this technology?&#8221;) but they are also sometimes in the area of the business domain (&#8220;is this a good idea?&#8221;) too. One key idea is that the at the end of the spike, it is thrown away. It&#8217;s not supposed to be used as production code, it&#8217;s just supposed to answer some questions about the project, to validate or invalidate particular approaches to a problem, to provide further clarity around unknowns, to explore risk, to help with estimation, etc. I think this can be a useful general idea when dealing with technology, even in a &#8220;production&#8221; context.</p>
<p>Recently I was learning <a href="http://www.antlr.org">ANTLR</a>, trying to decide whether this was a right technology to pursue a particular project which involved parsing a preexisting message format. After a week of a spike, we decided that it was worth pursuing and started on earnest on the grammar for our project. However a week into this process, I had an epiphany &#8230; I was doing some things wrong with the ANTLR grammar which were now slowing progress in adding the new characteristics it needed to be complete. Many developers know this feeling; the features of my grammar that I had built over the first week were naive and now hampering it from expanding into the new requirements. I took it on myself to kill the entire grammar and start again. It took less than a day and half to replicate that week&#8217;s worth of work (i.e. pass the test suite which had built up around it).  I&#8217;ve done this before; scrap the first attempt at building a domain and try again. Here my domain was the same (it was after all defined in both a standards specification and in the many hundreds of thousands of sample messages we captured from an existing system), but its implementation needed refinement.</p>
<p>So I think that the rule about throwing away spikes can in fact be made a general axiom of programming:</p>
<blockquote><p>When you are learning a new technology, make sure you  throw away the first thing you build that works &#8211; to avoid accumulating  your mistakes.</p></blockquote>
<p>Thanks to <a href="http://www.twasink.net/">Robert</a> for the important qualifier &#8220;that works&#8221;. <img src='http://www.crazymcphee.net/x/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>N.B. my views about <a title="The rewrite will be ready shortly" href="http://www.crazymcphee.net/x/2009/02/01/the-rewrite-will-be-ready-shortly/">system  rewrites</a> have not changed regardless.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2010/05/30/throw-it-away-and-write-another-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The rewrite will be ready shortly</title>
		<link>http://www.crazymcphee.net/x/2009/02/01/the-rewrite-will-be-ready-shortly/</link>
		<comments>http://www.crazymcphee.net/x/2009/02/01/the-rewrite-will-be-ready-shortly/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 00:58:09 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[poorly attempted humour]]></category>
		<category><![CDATA[refactor]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=121</guid>
		<description><![CDATA[You might have seen the following cartoon before: It&#8217;s from a site called The Project Cartoon. What I didn&#8217;t know was the site allows you to use the little cartoons to make your own version. You can caption and re-order the panels. For your amusement, and perhaps your edification, I present &#8220;The Rewrite Will Be [...]]]></description>
			<content:encoded><![CDATA[<p>You might have seen the following cartoon before:</p>
<div id="attachment_120" class="wp-caption alignnone" style="width: 310px"><a href="http://www.projectcartoon.com/cartoon/3"><img class="size-medium wp-image-120" title="How the customer explained it ... what the customer needed" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/02/how-the-customer-explaned-it-300x225.jpg" alt="The Project Cartoon - how the customer explained it, what we built them &amp; what the customer actually needed" width="300" height="225" /></a><p class="wp-caption-text">The Project Cartoon - how the customer explained it, what we built them &amp; what the customer actually needed</p></div>
<p>It&#8217;s from a site called <a title="The Project Cartoon" href="http://www.projectcartoon.com/" target="_blank">The Project Cartoon</a>. What I didn&#8217;t know was the site allows you to use the little cartoons to make your own version. You can caption and re-order the panels.  For your amusement, and perhaps your edification, I present &#8220;The Rewrite Will Be Ready Shortly&#8221;:</p>
<div id="attachment_125" class="wp-caption alignnone" style="width: 490px"><a href="http://www.projectcartoon.com/cartoon/42216"><img class="size-full wp-image-125" title="The Rewrite Will Be Ready Shortly" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/02/therewrite600.jpg" alt="The existing software is ugly and poorly written. We will have to rewrite it if you want any new features." width="480" height="339" /></a><p class="wp-caption-text">The existing software is ugly and poorly written. We will have to rewrite it if you want any new features.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/02/01/the-rewrite-will-be-ready-shortly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code re-writes and U.S. health care reform</title>
		<link>http://www.crazymcphee.net/x/2009/01/20/code-re-writes-and-us-health-care-reform/</link>
		<comments>http://www.crazymcphee.net/x/2009/01/20/code-re-writes-and-us-health-care-reform/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 08:16:53 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[professional practice]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[emergent design]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[refactor]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=70</guid>
		<description><![CDATA[This post is not about health-care, per se. This is about &#8220;re-writes&#8221; or &#8220;total reforms&#8221; of systems. An argument Atul Gawande makes in New Yorker magazine about health-care reform: [Certain reformists say] The country has this one chance, the idealist maintains, to sweep away our inhumane, wasteful patchwork system and replace it with something new [...]]]></description>
			<content:encoded><![CDATA[<p>This post is not about health-care, per se. This is about &#8220;re-writes&#8221; or &#8220;total reforms&#8221; of systems. <a href="http://www.newyorker.com/reporting/2009/01/26/090126fa_fact_gawande?currentPage=all">An argument Atul Gawande makes in New Yorker magazine about health-care reform</a>:</p>
<blockquote><p>[Certain reformists say] The country has this one chance, the idealist maintains, to sweep away our inhumane, wasteful patchwork system and replace it with something new and more rational. So we should prepare for a bold overhaul, just as every other Western democracy has. True reform requires transformation at a stroke. But is this really the way it has occurred in other countries? The answer is no. And the reality of how health reform has come about elsewhere is both surprising and instructive.</p></blockquote>
<p>He goes at lengths to explain how the health care that the rest of the developed world (e.g. Australia) has found itself with, are the results of ad-hoc changes to existing systems, not large-scale rewrites. As a result, every country has a &#8220;path-dependent&#8221; health care system. For example, Britain&#8217;s NHS evolved in 1945 from wartime requirements and infrastructure. After the way, France&#8217;s infrastructure was largely destroyed, so they used (that is, modified and extended) an existing system of union organised health care insurance paid for through payroll taxes. And so on. Everyone&#8217;s system is different because their initial conditions where different, and solutions have to respect what&#8217;s there, and not just blithely sweep it all aside.</p>
<p>This possibly could give us a <em>general</em> principle with regards to all types of reform -<em> you have to work with what you&#8217;ve got</em>. That includes software.</p>
<p>We&#8217;ve <a href="http://www.oreillynet.com/onlamp/blog/2007/08/informal_survey_do_rewrites_re.html" target="_blank">known</a> for <a title="Joel On Software - Things Not To Do" href="http://www.joelonsoftware.com/articles/fog0000000069.html" target="_blank">some time</a> that the <a title="The Big Rewrite" href="http://chadfowler.com/2006/12/27/the-big-rewrite" target="_blank">big rewrite</a><a href="http://www.ronkes.nl/blog/?2005-04-15-neverrewritecode" target="_blank"> nearly always</a> <a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html" target="_blank">ends</a> in <a href="http://www.jwz.org/gruntle/nomo.html" target="_blank">failure</a> (although <a href="http://codehappy.wordpress.com/tag/rewrites-development-code-smells/" target="_blank">not everyone</a> <a href="http://my.opera.com/Vorlath/blog/2007/09/25/code-rewrite-yes" target="_blank">agrees</a>). Especially when the specification for the new system is &#8220;make it do what the old system does&#8221;. Why are you re-writing it then?! (<a title="Software as the The Spec" href="http://chadfowler.com/index.cgi/Computing/Programming/TheBigRewrite/TheSpec.rdoc,v" target="_blank">Chad Fowler has an excellent article about this</a>).</p>
<p>It&#8217;s an excellent general principle that software systems should to evolve  incrementally over time. Has anyone else worked in an environment where they&#8217;ve spent 12, 18, 24 months squirrelled away somewhere vigorously rewriting an entire system while the existing system is still being maintained and improved? Not so long ago I worked on a system where we spent 4 months re-writing just a small section of a piece of software &#8211; delivered in two steps &#8211; and it was bad enough as it was. But a <em>year</em>? It just has to be disastrous.</p>
<p>What&#8217;s important is your initial set of conditions, which shape the scope of what is actually possible to do &#8211; and importantly, how you&#8217;d go about doing it. Your future system is &#8220;path dependent&#8221; on the existing one, and that was dependant on what was there before.  Software developers frequently chafe at these limits, and instead form a desire to just chuck it out and start over. But you are dooming yourself to failure if you do that.</p>
<p>Part of our professional practices  should be the delivery of <a title="Emergent Design" href="http://www.crazymcphee.net/x/2009/01/13/emergent-design/" target="_self">incremental design to systems</a>. Instead of that 4 month re-write of a small section of functionality could we have delivered it in even smaller chunks? My feeling is <em>quite probably, yes</em> &#8211; and it would have been a lot less stressful at the time too. Always work with what you&#8217;ve got, and change -and <em>improve</em> &#8211; it one small piece at a time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/01/20/code-re-writes-and-us-health-care-reform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

