<?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: Motivating Beautiful Code</title>
	<atom:link href="http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/</link>
	<description>Summa Blog</description>
	<pubDate>Sat, 13 Mar 2010 04:44:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jeff stonebrook</title>
		<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/comment-page-1/#comment-28</link>
		<dc:creator>Jeff stonebrook</dc:creator>
		<pubDate>Tue, 20 Jan 2009 14:02:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.summa-tech.com/blog/?p=66#comment-28</guid>
		<description>So - let me speak to this from the perspective of the manager who doesn't want the code changed.

Often times, the manager is trying to be risk-adverse by not allowing a troublesome piece of code to be changed.  But in pushing off the refactoring / beautification - the risk is just being pushed off, not adverted.  

But what this is crying for is better unit testing on this piece of code.  If you have a robust set of unit tests for a piece of code, managers are much more likely to allow the code to be refactored because your unit tests will help define if the code changes that were made did not break any of the functionality of the code.

Therefore, when dealing with a manager who is concerned about changing the code - think about it from their perspective.  They are worried about destabalizing the source code base not just the time investment involved.  Combat this with a well-defined unit testing framework and test suite, and I think your arguments to refactor / beautify will be met with much less resistance.</description>
		<content:encoded><![CDATA[<p>So - let me speak to this from the perspective of the manager who doesn&#8217;t want the code changed.</p>
<p>Often times, the manager is trying to be risk-adverse by not allowing a troublesome piece of code to be changed.  But in pushing off the refactoring / beautification - the risk is just being pushed off, not adverted.  </p>
<p>But what this is crying for is better unit testing on this piece of code.  If you have a robust set of unit tests for a piece of code, managers are much more likely to allow the code to be refactored because your unit tests will help define if the code changes that were made did not break any of the functionality of the code.</p>
<p>Therefore, when dealing with a manager who is concerned about changing the code - think about it from their perspective.  They are worried about destabalizing the source code base not just the time investment involved.  Combat this with a well-defined unit testing framework and test suite, and I think your arguments to refactor / beautify will be met with much less resistance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Handerson Gomes</title>
		<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/comment-page-1/#comment-21</link>
		<dc:creator>Handerson Gomes</dc:creator>
		<pubDate>Sun, 18 Jan 2009 21:59:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.summa-tech.com/blog/?p=66#comment-21</guid>
		<description>I would add that making the smell public within the organization is another strategy to be considered by the team. In many cases the developers are the only ones being affected and close to the smell, and therefore I can see why some managers don't  value the investment to improve the beauty of the code. 
Creating a project/product site with reports including reports like PMD, Crap4J, Cobertura and making it available is one way to show that the smell is there and it need to be fixed.

Continuous Integration is a great way to show and track the evolution of the code base.</description>
		<content:encoded><![CDATA[<p>I would add that making the smell public within the organization is another strategy to be considered by the team. In many cases the developers are the only ones being affected and close to the smell, and therefore I can see why some managers don&#8217;t  value the investment to improve the beauty of the code.<br />
Creating a project/product site with reports including reports like PMD, Crap4J, Cobertura and making it available is one way to show that the smell is there and it need to be fixed.</p>
<p>Continuous Integration is a great way to show and track the evolution of the code base.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Tasse</title>
		<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/comment-page-1/#comment-16</link>
		<dc:creator>Dan Tasse</dc:creator>
		<pubDate>Fri, 16 Jan 2009 21:53:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.summa-tech.com/blog/?p=66#comment-16</guid>
		<description>One thing that's really nice is if your manager (and manager's manager, and so on) is a programmer too.  I guess this happens more in software companies than for consultants.  It really helps: the discussion becomes not "should we make the code more elegant?", but "how elegant should we make it?"  My manager's been more than understanding when I've been trying to really make code the best quality code that it can be.

I don't know how this helps the conversation.  I hope it's not just a case of "you can't know what it's like to work with good/bad code unless you have done it yourself."  In that case, it is just a trust thing, like a car mechanic.  If you trust your mechanic, and he recommends replacing some belt or something even though the car's working okay now, you'll let him do it; if not, you'll figure he's gouging you, and not do it (and then your car will fail spectacularly in a month).  Unfortunately, code is maybe even harder to measure than cars.

In short, I agree!</description>
		<content:encoded><![CDATA[<p>One thing that&#8217;s really nice is if your manager (and manager&#8217;s manager, and so on) is a programmer too.  I guess this happens more in software companies than for consultants.  It really helps: the discussion becomes not &#8220;should we make the code more elegant?&#8221;, but &#8220;how elegant should we make it?&#8221;  My manager&#8217;s been more than understanding when I&#8217;ve been trying to really make code the best quality code that it can be.</p>
<p>I don&#8217;t know how this helps the conversation.  I hope it&#8217;s not just a case of &#8220;you can&#8217;t know what it&#8217;s like to work with good/bad code unless you have done it yourself.&#8221;  In that case, it is just a trust thing, like a car mechanic.  If you trust your mechanic, and he recommends replacing some belt or something even though the car&#8217;s working okay now, you&#8217;ll let him do it; if not, you&#8217;ll figure he&#8217;s gouging you, and not do it (and then your car will fail spectacularly in a month).  Unfortunately, code is maybe even harder to measure than cars.</p>
<p>In short, I agree!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Howell</title>
		<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/comment-page-1/#comment-15</link>
		<dc:creator>Jeff Howell</dc:creator>
		<pubDate>Fri, 16 Jan 2009 20:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.summa-tech.com/blog/?p=66#comment-15</guid>
		<description>Brian, 

You hit the nail on the head.  So the answer has to start with &lt;i&gt;"depends"&lt;/i&gt; ...

One strategy is to find an incremental approach.  Manager have an easier time if you can present a case like, "I have several small steps in mind, about 4-8 hours each, that will improve this troublesome code.  At the end of each step, the code will be fully working and a little better then when I started".  The point here is to give control of the process to the manager so they can decide if time/budget is available and make a trade off decision.

Another strategy is to attack as you work through bug reports.  Each time a bug is investigated, make a deal with the manager that you will make improvements via tests and coding improvements in the specific area of the bug.  Like the preceding strategy, the manager is still in control and you are only adding a small incremental effort (since the bug had to be fixed anyway).  The increment needs to have value in preventing reoccurrence of the present bug and of future bugs that have similar location or characteristics.  The changes/tests will also strengthen the code so that future developers will have fewer problems understanding, extending, and maintaining.

For a real mess, you may have to do some initial work before you can even present a cogent case to the manager:  

If you can wrap the smelly class in some tests that verify current functionality, you may be able to incrementally improve it. Structure tests for two purposes: to identify current functionality that your incremental change inadvertently breaks; and to test the incremental change.  This will be imperfect, but much safer than without the tests.  Also, each incremental improvement adds more tests, so risk is lowered with each step.

You might also try mechanical refactorings like breaking methods into smaller methods, extracting "helper" or "utility" classes.  These are quick and relatively low risk and at least reduce the problem.  Once you work through some of these refactorings, the intent of the code will become more clear and you can begin to make more targeted refactorings.

Or you may try running a static code analyser like PMD or Eclipse Metrics.  Explain to your manager what Cyclical complexity means and try to get approval for incremental improvements that specifically improves the metrics.  This may appeal to the manager because it provides feedback of your refactoring activities.

--jH</description>
		<content:encoded><![CDATA[<p>Brian, </p>
<p>You hit the nail on the head.  So the answer has to start with <i>&#8220;depends&#8221;</i> &#8230;</p>
<p>One strategy is to find an incremental approach.  Manager have an easier time if you can present a case like, &#8220;I have several small steps in mind, about 4-8 hours each, that will improve this troublesome code.  At the end of each step, the code will be fully working and a little better then when I started&#8221;.  The point here is to give control of the process to the manager so they can decide if time/budget is available and make a trade off decision.</p>
<p>Another strategy is to attack as you work through bug reports.  Each time a bug is investigated, make a deal with the manager that you will make improvements via tests and coding improvements in the specific area of the bug.  Like the preceding strategy, the manager is still in control and you are only adding a small incremental effort (since the bug had to be fixed anyway).  The increment needs to have value in preventing reoccurrence of the present bug and of future bugs that have similar location or characteristics.  The changes/tests will also strengthen the code so that future developers will have fewer problems understanding, extending, and maintaining.</p>
<p>For a real mess, you may have to do some initial work before you can even present a cogent case to the manager:  </p>
<p>If you can wrap the smelly class in some tests that verify current functionality, you may be able to incrementally improve it. Structure tests for two purposes: to identify current functionality that your incremental change inadvertently breaks; and to test the incremental change.  This will be imperfect, but much safer than without the tests.  Also, each incremental improvement adds more tests, so risk is lowered with each step.</p>
<p>You might also try mechanical refactorings like breaking methods into smaller methods, extracting &#8220;helper&#8221; or &#8220;utility&#8221; classes.  These are quick and relatively low risk and at least reduce the problem.  Once you work through some of these refactorings, the intent of the code will become more clear and you can begin to make more targeted refactorings.</p>
<p>Or you may try running a static code analyser like PMD or Eclipse Metrics.  Explain to your manager what Cyclical complexity means and try to get approval for incremental improvements that specifically improves the metrics.  This may appeal to the manager because it provides feedback of your refactoring activities.</p>
<p>&#8211;jH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Gray</title>
		<link>http://www.summa-tech.com/blog/2009/01/09/motivating-beautiful-code/comment-page-1/#comment-14</link>
		<dc:creator>Brian Gray</dc:creator>
		<pubDate>Mon, 12 Jan 2009 15:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.summa-tech.com/blog/?p=66#comment-14</guid>
		<description>Really interesting post -- and indeed something I have struggled with.  One thought I have: is it possible/desirable to motivate a large risk when necessary?  

Say, for example, you (the developer) have a large cumbersome class (with no unit tests) that keeps being the source of little bugs.  You want to beatify it, refactor, add tests, make it readable -- but this will take time and result in a functional match if all goes well (only hopefully without the defects).  

The manager sees a large time investment, the possibility of adding new bugs, and really doesn't see the problem with the mostly functional class that you have to dig into every few months, figure out how it works all over again, and put band-aids on.  Is there a good answer here?</description>
		<content:encoded><![CDATA[<p>Really interesting post &#8212; and indeed something I have struggled with.  One thought I have: is it possible/desirable to motivate a large risk when necessary?  </p>
<p>Say, for example, you (the developer) have a large cumbersome class (with no unit tests) that keeps being the source of little bugs.  You want to beatify it, refactor, add tests, make it readable &#8212; but this will take time and result in a functional match if all goes well (only hopefully without the defects).  </p>
<p>The manager sees a large time investment, the possibility of adding new bugs, and really doesn&#8217;t see the problem with the mostly functional class that you have to dig into every few months, figure out how it works all over again, and put band-aids on.  Is there a good answer here?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
