<?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: How to Refactor like a Something star</title>
	<atom:link href="http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/feed/" rel="self" type="application/rss+xml" />
	<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/</link>
	<description></description>
	<lastBuildDate>Tue, 08 Jun 2010 10:50:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Ben Butler-Cole</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5419</link>
		<dc:creator>Ben Butler-Cole</dc:creator>
		<pubDate>Wed, 30 Sep 2009 22:34:54 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5419</guid>
		<description>I would add: find a safe path. The ideal refactoring consists of a series of small steps that are known to be safe (that is, they don&#039;t change the behaviour of the code). Sometimes you have an improved design in mind but it isn&#039;t obvious how you get *there* from *here* (which reminds me of a joke about asking for directions). In that case it pays to try various routes to your destination (checking in frequently, being happy to revert) and persist in looking for a safe route.

As soon as you step off the path and make (even, what you think to be, temporarily) breaking changes then all is lost.

The great side-effect of this is that you can check in and walk away at almost any time, knowing that you have at least started things moving in the right direction, even if you haven&#039;t finished what you set out to do.

Ben</description>
		<content:encoded><![CDATA[<p>I would add: find a safe path. The ideal refactoring consists of a series of small steps that are known to be safe (that is, they don&#8217;t change the behaviour of the code). Sometimes you have an improved design in mind but it isn&#8217;t obvious how you get *there* from *here* (which reminds me of a joke about asking for directions). In that case it pays to try various routes to your destination (checking in frequently, being happy to revert) and persist in looking for a safe route.</p>
<p>As soon as you step off the path and make (even, what you think to be, temporarily) breaking changes then all is lost.</p>
<p>The great side-effect of this is that you can check in and walk away at almost any time, knowing that you have at least started things moving in the right direction, even if you haven&#8217;t finished what you set out to do.</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siim</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5377</link>
		<dc:creator>Siim</dc:creator>
		<pubDate>Wed, 30 Sep 2009 10:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5377</guid>
		<description>to felix:
I think by top-down she meant that when refactoring class&#039;s public interface, for example, you should first look its usages and start from there if necessary. And then proceed with class refactoring. When doing opposite, you could end up with big bubbling effect like Sarah described.</description>
		<content:encoded><![CDATA[<p>to felix:<br />
I think by top-down she meant that when refactoring class&#8217;s public interface, for example, you should first look its usages and start from there if necessary. And then proceed with class refactoring. When doing opposite, you could end up with big bubbling effect like Sarah described.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jen Smith</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5374</link>
		<dc:creator>Jen Smith</dc:creator>
		<pubDate>Wed, 30 Sep 2009 07:34:34 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5374</guid>
		<description>I can see the argument for dumping all low level unit tests when refactoring a subsystem (like your login example) - if the code is in that much need of a rewrite then the current unit tests aren&#039;t going to help.

But in the case of smaller changes to fairly well-test-covered code, you can often leave the unit tests in place. Even if you need to put some &#039;Assert.Fail()&#039; lines in a few tests here and there, the behaviour is still documented and you can revisit it later. 

Parallelizing can work very well at the method level too. I have often started a refactoring by adding in the new method to be used and gradually moving callers over to it. That way you don&#039;t break existing tests/behaviour until you actually need to and can perform regular checkins. Gives you a good scoping tool as well: i.e. &#039;We will get rid of all calls to this guy then stop and do something useful&#039;.</description>
		<content:encoded><![CDATA[<p>I can see the argument for dumping all low level unit tests when refactoring a subsystem (like your login example) &#8211; if the code is in that much need of a rewrite then the current unit tests aren&#8217;t going to help.</p>
<p>But in the case of smaller changes to fairly well-test-covered code, you can often leave the unit tests in place. Even if you need to put some &#8216;Assert.Fail()&#8217; lines in a few tests here and there, the behaviour is still documented and you can revisit it later. </p>
<p>Parallelizing can work very well at the method level too. I have often started a refactoring by adding in the new method to be used and gradually moving callers over to it. That way you don&#8217;t break existing tests/behaviour until you actually need to and can perform regular checkins. Gives you a good scoping tool as well: i.e. &#8216;We will get rid of all calls to this guy then stop and do something useful&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: felix</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5358</link>
		<dc:creator>felix</dc:creator>
		<pubDate>Mon, 28 Sep 2009 21:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5358</guid>
		<description>Interesting one. Even though I don&#039;t quite understand, what you mean by top-down introduction of new concepts. I usually find that if you don&#039;t go for the rewrite (possibly because there  is no nice interface in your existing code base), it&#039;s far easier to start extracting small concepts until the bigger ones emerge.  But then again I think the rewrite (of a well defined subsystem) has had way too much bad press in agile circles.</description>
		<content:encoded><![CDATA[<p>Interesting one. Even though I don&#8217;t quite understand, what you mean by top-down introduction of new concepts. I usually find that if you don&#8217;t go for the rewrite (possibly because there  is no nice interface in your existing code base), it&#8217;s far easier to start extracting small concepts until the bigger ones emerge.  But then again I think the rewrite (of a well defined subsystem) has had way too much bad press in agile circles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5353</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Mon, 28 Sep 2009 14:18:23 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5353</guid>
		<description>Nice post - I particularly like the bits about doing refactoring in parallel to existing code - I&#039;ve found that works out much better than breaking chunks of code while you try to change it.  

Sometimes it&#039;s also interesting just to take a copy of the code base on another checkout and just play around with refactorings while not caring whether or not you break anything.

That can be quite interesting for identifying abstractions that weren&#039;t obvious previously or showing other ways the code can be improved.</description>
		<content:encoded><![CDATA[<p>Nice post &#8211; I particularly like the bits about doing refactoring in parallel to existing code &#8211; I&#8217;ve found that works out much better than breaking chunks of code while you try to change it.  </p>
<p>Sometimes it&#8217;s also interesting just to take a copy of the code base on another checkout and just play around with refactorings while not caring whether or not you break anything.</p>
<p>That can be quite interesting for identifying abstractions that weren&#8217;t obvious previously or showing other ways the code can be improved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/how-to-refactor-like-a-something-star/comment-page-1/#comment-5350</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 28 Sep 2009 11:23:55 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=230#comment-5350</guid>
		<description>Nice post Sarah!

I have to admit sometimes I am too quick to code when refactoring - and it has cost me. Recently I have been adding a process to my dev work (incl. refactoring) - I called it COMIK (http://bit.ly/4eMOm2) but the main emphasis is on good planning.

As you put it &quot;painting yourself into a corner&quot; can be both demoralising and frustrating (time wasting aside!).</description>
		<content:encoded><![CDATA[<p>Nice post Sarah!</p>
<p>I have to admit sometimes I am too quick to code when refactoring &#8211; and it has cost me. Recently I have been adding a process to my dev work (incl. refactoring) &#8211; I called it COMIK (<a href="http://bit.ly/4eMOm2" rel="nofollow">http://bit.ly/4eMOm2</a>) but the main emphasis is on good planning.</p>
<p>As you put it &#8220;painting yourself into a corner&#8221; can be both demoralising and frustrating (time wasting aside!).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
