<?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>henko.net &#187; Principles</title>
	<atom:link href="http://henko.net/category/imperfection/principles/feed/" rel="self" type="application/rss+xml" />
	<link>http://henko.net</link>
	<description>Home of a human being and software developer</description>
	<lastBuildDate>Wed, 21 Dec 2011 11:12:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Real world refactoring</title>
		<link>http://henko.net/imperfection/real-world-refactoring/</link>
		<comments>http://henko.net/imperfection/real-world-refactoring/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 20:32:13 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>

		<guid isPermaLink="false">http://henko.net/?p=897</guid>
		<description><![CDATA[The tram stop next to my apartment has been completely rebuilt during the last few weeks. They removed every part of the old one, including the actual little shelter, the fence, the curb, the pavement &#8212; everything. A pretty major change as far as tram stop remakes go. It could be seen as a clear [...]]]></description>
			<content:encoded><![CDATA[<p>The tram stop next to my apartment has been completely rebuilt during the last few weeks. They removed every part of the old one, including the actual little shelter, the fence, the curb, the pavement &#8212; everything. A pretty major change as far as tram stop remakes go. It could be seen as a clear improvement. Tram Stop 2.0, if you wish.</p>

<p><img src="http://henko.net/wp-content/uploads/2010/06/crossing-300x225.jpg" alt="Rebuilding a crossing" title="Rebuilding a crossing" width="300" height="225" class="alignright size-medium wp-image-899" /></p>

<p>They also created a new pedestrian crossing next to the tram stop. And there was one thing about it that I noticed. One side of the crossing was connected to the tram stop and the curb there was just rebuilt. The other side of the street had a perfectly fine curb, and it would have been no problems to just paint lines on the street and be done with the crossing. But they didn&#8217;t.</p>

<p>Instead, they ripped up the street, curb and part of the sidewalk on that side too. Why? The reason is that they wanted to improve that side of the crossing too. They&#8217;re making the sidewalk about half a meter wider and thereby narrowing the street. That makes it a little bit clearer that it is a crossing and therefore makes the crossing safer. They&#8217;ll lower the curb for a meter or so which makes crossing by bike or wheel-chair easier. That&#8217;s about it, as far as I know.</p>

<p>While arguably better, it didn&#8217;t really enable anything that wasn&#8217;t possible before. And it did cost money. Money that could have been spent elsewhere. And they had already spent a lot of money on rebuilding the tram stop. So why did they do it? I&#8217;m not sure, but I think whatever the reasons were, the same reasons could be used to motivate refactoring of software.</p>

<p>(Alright, that was possibly a crappy metaphor&#8230; but it&#8217;s my blog, and I&#8217;ll post what I want. <img src='http://henko.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/real-world-refactoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multitasking doesn&#8217;t work, but&#8230;</title>
		<link>http://henko.net/imperfection/multitasking-doesnt-work-but/</link>
		<comments>http://henko.net/imperfection/multitasking-doesnt-work-but/#comments</comments>
		<pubDate>Thu, 13 May 2010 08:15:51 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Principles]]></category>

		<guid isPermaLink="false">http://henko.net/?p=866</guid>
		<description><![CDATA[Great quote from Kent Beck at SDC2010. Multitasking doesn&#8217;t work, but it would be so nice if it did that we try anyway. That&#8217;s about the best summary of (human) multitasking I&#8217;ve heard. This picture is pretty good too, though.]]></description>
			<content:encoded><![CDATA[<p>Great quote from Kent Beck at <a href="http://www.scandevconf.se/2010/" title="SDC2010">SDC2010</a>.</p>

<blockquote>
  <p>Multitasking doesn&#8217;t work,<br />
  but it would be so nice if it did<br />
  that we try anyway.</p>
</blockquote>

<p>That&#8217;s about the best summary of (human) multitasking I&#8217;ve heard.</p>

<p>This picture is pretty good too, though.</p>

<div style="text-align: center"><a href="http://henko.net/wp-content/uploads/2010/05/62139938_94b4e251cd1.jpg"><img src="http://henko.net/wp-content/uploads/2010/05/62139938_94b4e251cd1-300x225.jpg" alt="The Myth of Multitasking, by Tim Morgan" title="The Myth of Multitasking, by Tim Morgan" width="300" height="225" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/multitasking-doesnt-work-but/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Local rules give global results</title>
		<link>http://henko.net/imperfection/local-rules-give-global-results/</link>
		<comments>http://henko.net/imperfection/local-rules-give-global-results/#comments</comments>
		<pubDate>Thu, 06 May 2010 13:53:47 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>
		<category><![CDATA[Process]]></category>

		<guid isPermaLink="false">http://henko.net/?p=856</guid>
		<description><![CDATA[Reading Richard Dawkins&#8217; book The Greatest Show on Earth, I got inspired by his description about genes. He talks about how genes are not the blueprints of the body, but rather a recipe for the body. In other words, the genes do not contain a complete (or even partial) description of the final result, but [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://henko.net/wp-content/uploads/2010/05/2576765496_18e063d8411.jpg"><img src="http://henko.net/wp-content/uploads/2010/05/2576765496_18e063d8411-204x300.jpg" alt="DNA and twisty green things" title="DNA and twisty green things, by Ethan Hein" width="204" height="300" class="alignright size-medium wp-image-860" /></a>Reading Richard Dawkins&#8217; book <a href="http://www.amazon.com/gp/product/1416594787?ie=UTF8&amp;tag=henkonet-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1416594787" title="The Greatest Show on Earth">The Greatest Show on Earth</a>, I got inspired by his description about genes. He talks about how genes are not the blueprints of the body, but rather a recipe for the body. In other words, the genes do not contain a complete (or even partial) description of the final result, but rather contain various instructions for how to create the body. Each gene contributes only with extremely low level instructions, but these instructions combine in almost incomprehensible ways to form our enormously complex bodies.</p>

<p>I very much liked the idea, that a set of very low level instructions, carefully chosen and carefully followed, could create something so complex and beautiful. Jurgen Appelo has expressed similar ideas regarding <a href="http://www.noop.nl/complexity/" title="complexity theory">complexity theory</a>, and how ant hills or bee hives are complex structures created without a master plan through individual bees&#8217; actions. Yet another connection would be local search algorithms, which find maxima in a landscape through looking only at their immediate surroundings.</p>

<p>Next, my brain started linking these ideas to software development. For example, Test-Driven Development. It is in its essence, a set of very simple rules. Write a test, write needed implementation, refactor. These three simple (at least in theory) steps is all that there is to it, when properly adhered to, it can give great results. Designs tend to be much more easy to use, contain less bloat, be more testable (duh!), and so on. Refactorings are another great example. A set of rules or recipes for how to transform a code base into a better code base.</p>

<p>Obviously, choosing the right set of rules to follow is the important part, as a bad set of rules will lead to crappy code just as an unwanted mutation in a human body may lead to e.g. cancer. But I guess the point I was trying to make is that there is immense power in follow simple rules.</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/local-rules-give-global-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Constraints are good</title>
		<link>http://henko.net/imperfection/constraints-are-good/</link>
		<comments>http://henko.net/imperfection/constraints-are-good/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 20:05:48 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>
		<category><![CDATA[Process]]></category>

		<guid isPermaLink="false">http://henko.net/?p=814</guid>
		<description><![CDATA[In a conversation with Michael Feathers at SDC2010, he mentioned something which I found very interesting. It was a very simple statement. Constraints are good. To me, that statement sounded rather odd. Constraints is a negative word to me, so intuitively I want to remove constraints. Thus, I asked him to clarify. And here&#8217;s what [...]]]></description>
			<content:encoded><![CDATA[<p>In a conversation with <a href="http://www.michaelfeathers.com/" title="Michael Feathers">Michael Feathers</a> at <a href="http://www.scandevconf.se/" title="SDC2010">SDC2010</a>, he mentioned something which I found very interesting. It was a very simple statement.</p>

<blockquote>
  <p>Constraints are good.</p>
</blockquote>

<p>To me, that statement sounded rather odd. Constraints is a negative word to me, so intuitively I want to remove constraints. Thus, I asked him to clarify. And here&#8217;s what he said (or rather, my interpretation of it).</p>

<p><a href="http://henko.net/wp-content/uploads/2010/04/3135942946_6013353f46_b1.jpg"><img src="http://henko.net/wp-content/uploads/2010/04/3135942946_6013353f46_b1-200x300.jpg" alt="A night shot of a high way." title="The first trail and star, by jonmartin" width="200" height="300" class="alignright size-medium wp-image-820" /></a>A big advantage of software development is that we can build virtually anything. However, that same fact also represents one of the biggest problems. &#8220;Anything&#8221; includes all the great things that we envision, but also all the crappy things which we typically produce. <img src='http://henko.net/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>

<p>Since the possibilities are endless, in theory nothing prevents us from creating something truly great. But &#8212; and here&#8217;s the thing &#8212; by adding wisely chosen constraints, we can eliminate some of the undesirable outcomes. That means, that even if we screw up a bit, we&#8217;re more likely to create something which is at least not half-bad because we&#8217;ve eliminated the really bad outcomes. If we stay within the constraints, that is&#8230;</p>

<p>Another way to see it is that just as any society needs some laws and rules in order to function smoothly, a software development team does too. Whereas an example in the first case may be &#8220;do not kill&#8221;, an example in the second could be &#8220;do not commit code which breaks the build&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/constraints-are-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimizing Irreversible Actions</title>
		<link>http://henko.net/imperfection/minimizing-irreversible-actions/</link>
		<comments>http://henko.net/imperfection/minimizing-irreversible-actions/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 06:00:11 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>

		<guid isPermaLink="false">http://henko.net/?p=173</guid>
		<description><![CDATA[Reading Lean Software Development, I stumbled upon the following quote. As a keynote speaker at a software conference, Enrico Zaninotto, an Italian economist, pointed out that the underlying economic mechanism for controlling complexity in just-in-time systems is minimizing irreversible actions. The notion of &#8220;minimizing irreversible actions&#8221; strikes me as a better way of capturing that [...]]]></description>
			<content:encoded><![CDATA[<p>Reading <a href="http://www.amazon.com/gp/product/0321150783?ie=UTF8&#038;tag=henkonet-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0321150783">Lean Software Development</a><img src="http://www.assoc-amazon.com/e/ir?t=henkonet-20&#038;l=as2&#038;o=1&#038;a=0321150783" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, I stumbled upon the following quote.</p>

<blockquote>
  <p>As a keynote speaker at a software conference, Enrico Zaninotto, an Italian economist, pointed out that the underlying economic mechanism for controlling complexity in just-in-time systems is minimizing irreversible actions.</p>
</blockquote>

<p><a href="http://flickr.com/photos/lucias_clay/2699584043/"><img src="http://henko.net/wp-content/uploads/2008/10/2699584043_a50b5056a4_m.jpg" alt="" title="Irreversible decision. (Image copyright by Lucias Clay)" width="118" height="240" class="alignright size-full wp-image-178" /></a>The notion of &#8220;minimizing irreversible actions&#8221; strikes me as a better way of capturing that whole idea than the more established &#8220;<a href="http://www.codinghorror.com/blog/archives/000705.html" title="last responsible moment">last responsible moment</a>&#8220;. The latter suggests that you should delay making decisions for as long as you can. I feel that sends the wrong signal. You can make decisions. You <em>must</em> make decisions. Not making a decision is a decision in itself. Just don&#8217;t make decisions that you cannot change &#8212; keep your options open. By thinking that you must not make decisions until the &#8220;last responsible moment&#8221;, it is easy to delay the decision longer than is actually responsible.</p>

<p>I believe this is especially true for software architecture. In the name of &#8220;last responsible moment&#8221;, many developers <a href="http://henko.net/imperfection/do-design/" title="Do design, just not Big and Up Front">avoid making architectural decisions</a>, thinking the architecture will emerge by itself. But to quote Grady Booch in a response to a letter &#8220;The Relevance of Architecture&#8221; in IEEE Software (Volume 24 Number 5).</p>

<blockquote>
  <p>Every system has an architecture; some are accidental, others intentional.</p>
</blockquote>

<p>Which is yours?</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/minimizing-irreversible-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better, not perfect</title>
		<link>http://henko.net/imperfection/better-not-perfect/</link>
		<comments>http://henko.net/imperfection/better-not-perfect/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 20:00:32 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>

		<guid isPermaLink="false">http://henko.net/?p=122</guid>
		<description><![CDATA[My apartment is not always in perfect condition, and cleaning up that mess isn&#8217;t exactly what I look forward to. Therefore, in a discussion with a friend about this subject, I complained about that I couldn&#8217;t come up with good rules for myself on how and when to clean. (I like rules &#8212; simple, consistent, [...]]]></description>
			<content:encoded><![CDATA[<p>My apartment is not always in perfect condition, and cleaning up that mess isn&#8217;t exactly what I look forward to. Therefore, in a discussion with a friend about this subject, I complained about that I couldn&#8217;t come up with good rules for myself on how and when to clean. (I like rules &#8212; simple, consistent, and easy-to-follow rules.)</p>

<p>Every time I manage to actually do a proper cleaning of my apartment, I usually think: &#8220;Okay, now the apartment is clean, it shouldn&#8217;t be too difficult to keep it this way. I&#8217;ll just make sure that after every day it is still clean.&#8221; That&#8217;s a great rule in theory but it never works in practice. As soon as you slip, and let the apartment get messy, you&#8217;re lost. It has now become more of a mess than you can muster energy for to clean up.</p>

<h3>A different strategy</h3>

<p>But my friend suggested a different strategy: &#8220;Before you go to bed every night, make sure that the apartment is at least a little bit cleaner than it was when you woke up.&#8221; This rule has worked out extremely well for me. They both work fine as long as I follow them every single day. The difference is when I slip, when I allow the apartment to become a bit of a mess, I won&#8217;t automatically freeze and ignore it. All I have to do is to remove <em>one</em> single thing from the floor or wash <em>one</em> single glass, and I will have fulfilled my promise. If I just keep doing this, my apartment will eventually be clean. And also, once I&#8217;ve picked this single thing from the floor, or washed that single glass, it&#8217;s rather easy to take another and a third one as well.</p>

<p>When your apartment finally is clean, you&#8217;ll have to use a bit more imagination to fulfill the rule. You might archive those payed bills lying in your closet, remove the clothes you never use in your wardrobe and send them to a suitable charity, or do any other thing that you&#8217;ve long thought of doing. This would never even have happened with my first rule as it would have acknowledged my apartment as clean and I would need to do no work.</p>

<h3>In software development</h3>

<p>The reason I&#8217;m talking here about cleaning my apartment, is that I believe the very same principle applies to software development as well. It&#8217;s easy to ignore accumulating technical debt in your system, become paralyzed by it, and not have energy to deal with it. In that situation, just ensure that the system gets <a href="http://henko.net/imperfection/improve-as-you-go/" title="Improve as you go">a little better by every commit</a>, and one day, you&#8217;ll realize that your system is really in quite nice shape. So don&#8217;t aspire to be perfect, just to become better every day and you&#8217;ll get there (or at least very close <img src='http://henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ).</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/better-not-perfect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve as you go</title>
		<link>http://henko.net/imperfection/improve-as-you-go/</link>
		<comments>http://henko.net/imperfection/improve-as-you-go/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 18:42:10 +0000</pubDate>
		<dc:creator>Henrik Jernevad</dc:creator>
				<category><![CDATA[Imperfection]]></category>
		<category><![CDATA[Principles]]></category>

		<guid isPermaLink="false">http://henko.net/imperfection/improve-as-you-go/</guid>
		<description><![CDATA[Sometimes we come to situation where we need to perform a major change in our code base, one that is likely to affect more or less the whole system and that would require many man-weeks to complete. Time that we typically do not have in the condensed schedule of a modern software development project. By performing the improvement step by step, at each commit, we can amortize the time spent over the course of the project, yet ensure that it performed.]]></description>
			<content:encoded><![CDATA[<p>Sometimes we come to situation where we need to perform a major change in our code base, one that is likely to affect more or less the whole system. This might be a application-wide refactoring such as extracting business logic from the controller into the model. It can be introducing in-code documentation into a undocumented system, or introducing unit tests in a legacy system (because only system&#8217;s we&#8217;ve inherited is lacking unit tests, right?).</p>

<p>No matter exactly what task it is, we&#8217;ll assume that completing it is something that would require many man-weeks to complete. Time that we typically do not have in the condensed schedule of a modern software development project. Thus, it can be hard to motivate spending the resources that would be required to perform such a change. All to often, this leads to a situation where change is regarded as &#8220;something that should be done, but which we don&#8217;t have time for right now&#8221;. That is the same thing as &#8220;something we will never do&#8221;. Furthermore, as we typically perform the improvement in order to make the code base easier to work with in the future, we want to  prioritize the parts of the system where we spend most of our development time.</p>

<h3>A simple rule</h3>

<p>In situations like this, I suggest the following rather simple rule.</p>

<blockquote>
  <p>Every time you commit, ensure that all files in that changeset are updated to the new standard.</p>
</blockquote>

<p>Thus, if your current commit touches a controller which contains business logic, you may not commit until you&#8217;ve extracted and merged it into the model. Or if your commit touches an undocumented or untested class, you may not commit until that problem has been corrected.</p>

<h3>Rationale</h3>

<p>The rationale behind this recommendation is twofold. First, the performing the change won&#8217;t feel like a gigantic task, as it only involves modifying a couple of classes at any time. This helps to get around the &#8220;something that should be done, but which we don&#8217;t have time for right now&#8221; problem. This helps to amortize the work over the course of the project.</p>

<p>Secondly, you don&#8217;t spend time on updating files on which no one is working. This connects to the assumption that the improvement is done in order to make the code base easier to work with. Thus, as long as no one is working on a file, there is no need to make the improvement there. However, as soon as someone touches that file, it will brought up to the new standard. This is really just the <a href="http://www.codinghorror.com/blog/archives/000705.html" title="Last Responsible Moment">Last Responsible Moment</a> principle, or <a href="http://c2.com/xp/YouArentGonnaNeedIt.html" title="YAGNI">YAGNI</a>, put in a slightly different context.</p>

<p>As a bonus we reduce the risk that the change introduces bugs. This is because, as opposed to performing the change in one big go, only code on which the developer has just been working is updated. Thus, the developer is more familiar with the code and is in a better position to avoid introducing bugs by breaking non-obvious relationships and dependencies in the code. This advantage becomes more important the worse shape the code in question is in.</p>

<h3>Possible drawbacks</h3>

<p>To be fair, I should mention possible drawbacks. The major argument against this method is that the system is left in a &#8220;in between&#8221; state for an extended period of time. Depending on the type of change this could become problematic. If you&#8217;re switching from using one library to another, you might for a while be dependent on both libraries rather than any one of them. This might in turn create confusion about what library to use. Or if the system is in the middle of a major large scale refactoring, developers might in the same way be confused about the correct way to implement a feature.</p>

<p>I think that the best solution to this problem is to ensure that all developers are aware of what is happening. It&#8217;s really a question about communication within the team. Exactly how to solve this potential problem depends on the team. You can create a list of ongoing improvements which everybody can check when in doubt or when committing. You can emphasize collective ownership of the code and use pair programming to spread knowledge. Do whatever fits your team, as long as you consciously considers and manages the risk.</p>

<h3>Summing it up</h3>

<p>All in all, I think performing large scale changes in many smaller chunks is the preferred way to go. Pay off some of your <a href="http://www.martinfowler.com/bliki/TechnicalDebt.html" title="technical debt">technical debt</a> every day, rather than all of it at once. After all, to pay off your whole technical debt at once, you most likely will have to take on debt of some other kind &#8212; economical, working overtime, or implementing less new business value.</p>
]]></content:encoded>
			<wfw:commentRss>http://henko.net/imperfection/improve-as-you-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

