<?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: When not to refactor</title>
	<atom:link href="http://blog.xebia.com/2008/07/18/when-not-to-refactor/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/</link>
	<description></description>
	<lastBuildDate>Thu, 11 Mar 2010 16:23:01 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: nothing blog from outer space : To refactor or not to refactor</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-92196</link>
		<dc:creator>nothing blog from outer space : To refactor or not to refactor</dc:creator>
		<pubDate>Tue, 28 Jul 2009 15:07:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-92196</guid>
		<description>[...] Das Refactoring von gr&#246;sseren Projekten bringt jedoch auch Risiken mit sich: Zum einen ist schwer abzusch&#228;tzen, wann der Code f&#252;r die Ver&#246;ffentlichung „sch&#246;n genug“ ist, und Refactoring kann zum teuren Selbstl&#228;ufer werden. Zum anderen besteht eine reale Gefahr, vorhandenen Code zu besch&#228;digen: Denn die Einzelteile des bestehenden Systems sind unter Umst&#228;nden st&#228;rker miteinander verwoben, als dies auf den ersten Blick ersichtlich ist. Eine unbedachte &#196;nderung einer Methode kann andernorts zu unerw&#252;nschten Nebeneffekten f&#252;hren. Automatisierte Tests helfen, dieses Risiko zu verringern, doch auch diese m&#252;ssen sorgf&#228;ltig erstellt werden und die richtigen Bedingungen testen. Schliesslich ist eine sorgf&#228;ltige Zeitplanung notwendig, um ein Projekt trotz Refactoring fristgerecht abliefern zu k&#246;nnen – auch sch&#246;ner Code n&#252;tzt wenig, wenn er nie produktiv eingesetzt wird. (Gr&#252;nde, auf ein Refactoring zu verzichten.) [...]</description>
		<content:encoded><![CDATA[<p>[...] Das Refactoring von gr&#246;sseren Projekten bringt jedoch auch Risiken mit sich: Zum einen ist schwer abzusch&#228;tzen, wann der Code f&#252;r die Ver&#246;ffentlichung „sch&#246;n genug“ ist, und Refactoring kann zum teuren Selbstl&#228;ufer werden. Zum anderen besteht eine reale Gefahr, vorhandenen Code zu besch&#228;digen: Denn die Einzelteile des bestehenden Systems sind unter Umst&#228;nden st&#228;rker miteinander verwoben, als dies auf den ersten Blick ersichtlich ist. Eine unbedachte &#196;nderung einer Methode kann andernorts zu unerw&#252;nschten Nebeneffekten f&#252;hren. Automatisierte Tests helfen, dieses Risiko zu verringern, doch auch diese m&#252;ssen sorgf&#228;ltig erstellt werden und die richtigen Bedingungen testen. Schliesslich ist eine sorgf&#228;ltige Zeitplanung notwendig, um ein Projekt trotz Refactoring fristgerecht abliefern zu k&#246;nnen – auch sch&#246;ner Code n&#252;tzt wenig, wenn er nie produktiv eingesetzt wird. (Gr&#252;nde, auf ein Refactoring zu verzichten.) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manish Sharma</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-49763</link>
		<dc:creator>Manish Sharma</dc:creator>
		<pubDate>Tue, 12 Aug 2008 06:08:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-49763</guid>
		<description>Avoiding refactoring due to lack of time and other factors is a commonly observed in software development. But one thing commonly observed is that we either try to refactor full code or none whereas I believe refactoring is a step by step process. 

Taking you case as example, I would have refactored the duplicate code (visible smell) and moved on with Task X. Sometime later when I or someone else visits the service class then refactor a bit more with unit tests.</description>
		<content:encoded><![CDATA[<p>Avoiding refactoring due to lack of time and other factors is a commonly observed in software development. But one thing commonly observed is that we either try to refactor full code or none whereas I believe refactoring is a step by step process. </p>
<p>Taking you case as example, I would have refactored the duplicate code (visible smell) and moved on with Task X. Sometime later when I or someone else visits the service class then refactor a bit more with unit tests.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sara</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47963</link>
		<dc:creator>Sara</dc:creator>
		<pubDate>Mon, 21 Jul 2008 02:54:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47963</guid>
		<description>Very good points. I would also maintain that if the smelly code is driving you crazy enough to refactor in your spare time none of these rules apply.</description>
		<content:encoded><![CDATA[<p>Very good points. I would also maintain that if the smelly code is driving you crazy enough to refactor in your spare time none of these rules apply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gerard Janssen</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47893</link>
		<dc:creator>Gerard Janssen</dc:creator>
		<pubDate>Sun, 20 Jul 2008 06:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47893</guid>
		<description>Age has an interesting take on this question. It sounds reasonable, but I&#039;m not sure if I agree with it. Sure it is useful to add a user story to make the technical debt visible. But I do not agree that the technical debt was actually increased by this action. It was already there, only hidden. So it remains the question what the long term effect will be. If it will never hurt enough, it is best left alone. I agree that when building new software you should optimize your unit testing (although taking that to far might also get you into trouble as we have experienced in the past...), but when working with existing code you do need to be careful not to go to far with this. 
Writing unit tests is done for a purpose. In this case for being able to refactor smelly code. But smelly code is not the same as broken code. I think in this case the right decision was made to not invest the clients money to refactor, but to save it for adding value in the form of new features. So how about stating that not having unit tests for smelly code is not technical debt at all and that not having unit test for broken code or for code that needs to be changed consists of technical debt. So is it technical debt? It depends.  For new code this is different. Here you create unit tests to verify you new code works, so the decision is much easier made to write unit tests.
Just writing unit tests for every piece of existing code is not a wise investment of money. If you are not going to need it, don&#039;t.</description>
		<content:encoded><![CDATA[<p>Age has an interesting take on this question. It sounds reasonable, but I&#8217;m not sure if I agree with it. Sure it is useful to add a user story to make the technical debt visible. But I do not agree that the technical debt was actually increased by this action. It was already there, only hidden. So it remains the question what the long term effect will be. If it will never hurt enough, it is best left alone. I agree that when building new software you should optimize your unit testing (although taking that to far might also get you into trouble as we have experienced in the past&#8230;), but when working with existing code you do need to be careful not to go to far with this.<br />
Writing unit tests is done for a purpose. In this case for being able to refactor smelly code. But smelly code is not the same as broken code. I think in this case the right decision was made to not invest the clients money to refactor, but to save it for adding value in the form of new features. So how about stating that not having unit tests for smelly code is not technical debt at all and that not having unit test for broken code or for code that needs to be changed consists of technical debt. So is it technical debt? It depends.  For new code this is different. Here you create unit tests to verify you new code works, so the decision is much easier made to write unit tests.<br />
Just writing unit tests for every piece of existing code is not a wise investment of money. If you are not going to need it, don&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47872</link>
		<dc:creator>Mathias</dc:creator>
		<pubDate>Sat, 19 Jul 2008 22:07:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47872</guid>
		<description>I agree with Age Mooy. It sounds like the right decision in the short term: starting to refactor right now, just for one feature, with no tests in place, sounds like entering the jungle with just a pocket knife.
On the other hand, the key issue here is the absence of tests; that&#039;s not going to improve over time, and will make changes more and more painful over time.
I would discuss with the team and see whether there is an agreement to invest some time in putting in place the minimum missing tests so that next time you don&#039;t have the issue!</description>
		<content:encoded><![CDATA[<p>I agree with Age Mooy. It sounds like the right decision in the short term: starting to refactor right now, just for one feature, with no tests in place, sounds like entering the jungle with just a pocket knife.<br />
On the other hand, the key issue here is the absence of tests; that&#8217;s not going to improve over time, and will make changes more and more painful over time.<br />
I would discuss with the team and see whether there is an agreement to invest some time in putting in place the minimum missing tests so that next time you don&#8217;t have the issue!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank Smith</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47867</link>
		<dc:creator>Frank Smith</dc:creator>
		<pubDate>Sat, 19 Jul 2008 21:10:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47867</guid>
		<description>A good test suite is a prerequisite for effective refactoring. So this is one answer to your questions. If the team doesn&#039;t have good testing practices and it&#039;s not willing or able to pay that debt then refactoring should be done very carefully, if at all. 

It&#039;s analogous to asking &quot;when should someone not exercise?&quot;. If the person has a serious heart condition from years of smoking and being obese, they might want to consider exercising less than is normally recommended.</description>
		<content:encoded><![CDATA[<p>A good test suite is a prerequisite for effective refactoring. So this is one answer to your questions. If the team doesn&#8217;t have good testing practices and it&#8217;s not willing or able to pay that debt then refactoring should be done very carefully, if at all. </p>
<p>It&#8217;s analogous to asking &#8220;when should someone not exercise?&#8221;. If the person has a serious heart condition from years of smoking and being obese, they might want to consider exercising less than is normally recommended.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nanne</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47743</link>
		<dc:creator>Nanne</dc:creator>
		<pubDate>Fri, 18 Jul 2008 11:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47743</guid>
		<description>There is a good book &#039;Working Effectively with Legacy Code by Michael Feathers&#039; about this subject. It describes, amongst others, the situation you described above. The book offers pattern/solutions to problems you might encounter while working with legacy code. It addressed some problems I encounter on a daily basis.</description>
		<content:encoded><![CDATA[<p>There is a good book &#8216;Working Effectively with Legacy Code by Michael Feathers&#8217; about this subject. It describes, amongst others, the situation you described above. The book offers pattern/solutions to problems you might encounter while working with legacy code. It addressed some problems I encounter on a daily basis.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Age Mooy</title>
		<link>http://blog.xebia.com/2008/07/18/when-not-to-refactor/comment-page-1/#comment-47742</link>
		<dc:creator>Age Mooy</dc:creator>
		<pubDate>Fri, 18 Jul 2008 11:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=675#comment-47742</guid>
		<description>Did you add the lack of a good regression test to your backlog as a user story or an impediment ? I think you made the correct short-term decision but that does not mean the problem goes away. 

If you make these kinds of short-term decisions too often, you end up with (more) technical debt until it reaches a scale where you can&#039;t even fix it within one iteration anymore. Usually somewhere around that point you do have to change the code involved but by that time it is no longer possible to refactor it due to overwhelming technical debt.

Deciding to not refactor can be a good thing but you should always try to make sure that the problems you found does get solved at some point before they become major impediments.</description>
		<content:encoded><![CDATA[<p>Did you add the lack of a good regression test to your backlog as a user story or an impediment ? I think you made the correct short-term decision but that does not mean the problem goes away. </p>
<p>If you make these kinds of short-term decisions too often, you end up with (more) technical debt until it reaches a scale where you can&#8217;t even fix it within one iteration anymore. Usually somewhere around that point you do have to change the code involved but by that time it is no longer possible to refactor it due to overwhelming technical debt.</p>
<p>Deciding to not refactor can be a good thing but you should always try to make sure that the problems you found does get solved at some point before they become major impediments.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
