<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: Your code is not flat</title>
    <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Your code is not flat</title>
      <description>&lt;p&gt;There are three possibilities for the universe. On the one hand it is Closed. 
There&amp;#8217;s enough matter that the universe, currently expanding, will eventually 
stop expanding and collapse in on itself.&lt;/p&gt;


	&lt;p&gt;The universe might be open. There&amp;#8217;s not enough matter for gravitational forces
to bring the universe back in on itself.&lt;/p&gt;


	&lt;p&gt;The final option is that the universe is flat. There&amp;#8217;s just enough mass that it will stop
expanding but it will not collapse in on itself.&lt;/p&gt;


	&lt;p&gt;Assuming an infinite number of universes, the final option, the flat option,
must surly exist, somewhere. Probably not here, but somewhere. So for all 
intents and purposes, our universe is likely open or closed but not flat.&lt;/p&gt;


	&lt;p&gt;While you were reading that, your code rotted just a little. You&amp;#8217;ve heard of 
it, bit rot. The bits in a program sitting on a disk rot. It&amp;#8217;s a well known
fact. Sure the magnetic surface could give out or if it&amp;#8217;s in memory, a stray cosmic 
ray could flip a bit.&lt;/p&gt;


	&lt;p&gt;But that&amp;#8217;s not what I&amp;#8217;m talking about. You know the experience. It was just
working and now it is not working. You did not change anything so therefore
it is the same as it was and so something else must have changed. This is
bit rot.&lt;/p&gt;


	&lt;p&gt;Typically, bit rot is really just our expectations being crushed by reality.
Never let a fact get in the way of a good theory, that&amp;#8217;s my motto. This works
especially well if you tend to be a better talker than listener (guilty).&lt;/p&gt;


	&lt;p&gt;At any rate, your code continues to rot as you continue to read this. Why?
Someone using it has managed to find another thing programmers did not think about.
So what was &amp;#8220;working&amp;#8221; before is not &amp;#8220;working&amp;#8221; now. Wait, was it really working?
If someone was getting value out of using it then yes it was working. Is it
working now? If nothing about the system has changed but it no longer serves
a purpose, then it is not working.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s a question. If a tree falls in the forest and nobody hears it, does 
it make a sound? Answer from a human perspective, no. If there&amp;#8217;s nobody to
hear it, then it didn&amp;#8217;t make a sound. Sure it moved some air about and you
could take an infinite sum of sine waves to characterize that air movement
but then if you characterize it then something was there to observe it
and that seems to violate the spirit of &amp;#8220;nobody hears it.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;What about if there&amp;#8217;s a problem in the code and nobody hits it, does your 
code have a defect? Using the tree as an example, then the answer is no.
However, unlike the tree&amp;#8217;s sound, which quickly dissipates (if for no
other reason that then laws of thermodynamics), your code tends to stay
around a bit longer so the chance for observation of a sleeping 
defect is higher (though to be fair, if you wait long enough your code, like the sound in the forest, will go away).&lt;/p&gt;


	&lt;p&gt;OK, but it is even worse than that. Things change. If your body is not changing
then you are dead. That&amp;#8217;s a fact. In one study by Dr. Frisen, he demonstrated
the age of cells in a rib bone of a 30 year old to be just over 15 years, while
the cells that line the stomach to be closer to 5 days. Your body is constantly
fixing itself. Cells replace themselves. That&amp;#8217;s why you can donate platelets 
every 3 days and blood every 56 days.&lt;/p&gt;


	&lt;p&gt;What about your code? Is it fixing itself? Is it repairing itself? Does it need to?
If your code is not changing, then the project is dead. Sure, it takes some time
for all usefulness to finally wear out of the system but at some point the
system will essentially bit rot so badly that is serves no useful purpose.
(While there are multiple clinical definitions of &amp;#8220;dead&amp;#8221; for a body, some life
remains long after you are clinically dead &amp;#8211; your fingernails will keep growing
for some time after you expire.)&lt;/p&gt;


There are several things that cause your system to decay. Here are just a
few:
	&lt;ul&gt;
	&lt;li&gt;What the business needs changed so until the system catches up it has less value&lt;/li&gt;
		&lt;li&gt;The act of introducing the system has changed the business so that the system needs to change&lt;/li&gt;
		&lt;li&gt;Someone misunderstood something (it&amp;#8217;s actually no small miracle that people can communicate at all &amp;#8211; my wife would argue she cannot get through to me)&lt;/li&gt;
		&lt;li&gt;Someone actually changed some code badly (most 1-line bug fixes introduce new defects &amp;#8211; see Weinberg)&lt;/li&gt;
		&lt;li&gt;Someone is compelled to hack it in to meet the deadline/demo/beat the lunch crowd/...&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Your code is rotting while you read this because the environment around it is 
changing. Add to that an observation that most changes to code
introduce rather than reduce chaos and it&amp;#8217;s no wonder your system is either
closed (code collapses in on itself, weighed down by its own incidental complexity) or open (nobody can decide what to do and
the project eventually sort of fizzles into nothingness).&lt;/p&gt;


	&lt;p&gt;So what are you doing to actively maintain your system&amp;#8217;s integrity? Are you 
just using antibiotics (patching things quickly hoping that there&amp;#8217;s no super
bug on the horizon &amp;#8211; there&amp;#8217;s always a super bug on the horizon no matter 
how strong an alligator&amp;#8217;s immune system might be), or are you doing what
the surgeon general has been saying for years: getting enough sleep, 
working out regularly, eat healthily (there&amp;#8217;s a moving target).&lt;/p&gt;


	&lt;p&gt;Your code is rotting every day in every way unless you are actively working 
against that tide. Talking to your users &amp;#8211; being friendly even, writing tests 
(acceptance, integration, smoke, unit, load, exploratory, ... mostly automated),
integrating often, refactoring, learning to see beginning of rot rather than the end of it, etc.&lt;/p&gt;


	&lt;p&gt;There are a lot of things we can do and need to do to make a system. Part of that
is keeping the system alive and breathing. Unlike biological systems where nature
(and natural selection) has resulted in a self-monitoring, self-healing systems, code
does not really monitor itself and fix itself (well most code does not do that).&lt;/p&gt;


	&lt;p&gt;Maybe there&amp;#8217;s been a hidden force driving the creation of these things we
called code maintainers whose existence is predicated on the need to
repair living code to keep it around just a bit longer.&lt;/p&gt;


	&lt;p&gt;If this is the case, then just like the waist lines of americans are increasing 
as our biological systems have not had enough time to adjust to the changing 
environment, our code bases are bloating and getting to the point where code 
maintainers cannot keep the systems living long enough.&lt;/p&gt;


	&lt;p&gt;It seems a shift is in order to make it possible to keep these living, but often
very sick, applications alive longer. In a sense, if you are practicing keeping your
code clean, you are like a doctor because you diagnosing sickness, prescribing 
a path to heath and, if necessary, making incisions, using slugs or just waiting
for a given sickness to simply follow its natural course before going away (like the 
requirement that simply must be done right away, just because).&lt;/p&gt;


	&lt;p&gt;Unfortunately, if we are calling ourselves doctors, then we&amp;#8217;re still learning the value of
keeping our hands clean between procedures. Unlike doctors of the mid-19th century
who thought more blood on clothes = more experience, Ignaz Semmelweis figured 
out that hand washing saved lives.&lt;/p&gt;


	&lt;p&gt;As a community we&amp;#8217;re not there yet. There&amp;#8217;s still pride is hacking something together.&lt;/p&gt;


	&lt;p&gt;Your code is getting worse, what are you going to do about it?&lt;/p&gt;</description>
      <pubDate>Mon, 05 May 2008 23:35:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:270143c7-bfa7-491e-a827-6672b0ad46bb</guid>
      <author>Brett Schuchert</author>
      <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat</link>
      <category>Schuchert's Scattered Synapses </category>
      <category>bit</category>
      <category>rot</category>
      <category>clean</category>
      <category>code</category>
    </item>
    <item>
      <title>"Your code is not flat" by Jurgen Appelo</title>
      <description>&lt;p&gt;Brett,&lt;/p&gt;


	&lt;p&gt;I replied to your article with a post of my own:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.noop.nl/2008/05/the-virtue-of-j.html" rel="nofollow"&gt;The Virtue of Junk Code&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;i&gt;&amp;#8220;I believe it is time for someone to stand up in defense of millions of developers who cannot seem to get around to clean up their act, or their code.&amp;#8221;&lt;/i&gt;&lt;/p&gt;


	&lt;p&gt;Hope you like it! ;)&lt;/p&gt;</description>
      <pubDate>Tue, 06 May 2008 16:32:58 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:fe2ed2ac-74a2-4411-a22e-3467a2b0534e</guid>
      <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat#comment-1756</link>
    </item>
    <item>
      <title>"Your code is not flat" by Brett L. Schuchert</title>
      <description>&lt;p&gt;You know, I&amp;#8217;m not surprised about the open universe thing.&lt;/p&gt;


	&lt;p&gt;That fingernail thing is a great one! It&amp;#8217;s right up there with the 10,000 steps per day (no research on that one, it was an advertising thing by a pedometer manufacturer &amp;#8211; in Australia I think) or flowing glass in old windows (installers used to put the thick end on the bottom), etc.&lt;/p&gt;


	&lt;p&gt;That alone is the source of an article!  How do requirements that aren&amp;#8217;t real live on? (Or something like that.)&lt;/p&gt;


	&lt;p&gt;However, I am not depressed by the message &amp;#8211; maybe about the universe, but not about code.&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s life. Everything takes care, love and feeding. You, your partner/spouse, your pets,  your friends, your parents, your house, everything.&lt;/p&gt;


Then there&amp;#8217;s two schools of maintenance (and this is another reoccurring theme):
	&lt;ul&gt;
	&lt;li&gt;It&amp;#8217;s an event&lt;/li&gt;
		&lt;li&gt;It&amp;#8217;s a process&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;If it is an event, then there&amp;#8217;s no little attention paid to history. At some point, things &amp;#8220;happen&amp;#8221; and it&amp;#8217;s time to have a &amp;#8220;refactoring event.&amp;#8221; Or it&amp;#8217;s time to rewrite the entire code base.&lt;/p&gt;


	&lt;p&gt;If it is a process, then there&amp;#8217;s never a special time. It is continuous.&lt;/p&gt;


	&lt;p&gt;In a sense, I think of Refactoring (capital R) as an event-based mentality where as refactoring (lower case r) is a process.&lt;/p&gt;


	&lt;p&gt;Refactoring takes a long time. It needs to be scheduled and planned, there&amp;#8217;s never enough time until things are so bad that there&amp;#8217;s only time for it.&lt;/p&gt;


	&lt;p&gt;However, refactoring takes a short time. It needs to be practiced, not scheduled. There&amp;#8217;s always enough time because keeping things clean as a process or habit makes working easier, faster and more reliable.&lt;/p&gt;</description>
      <pubDate>Tue, 06 May 2008 10:22:59 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e9a21e9a-6a87-4981-8966-3d4fc5a630bd</guid>
      <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat#comment-1754</link>
    </item>
    <item>
      <title>"Your code is not flat" by Morbid</title>
      <description>&lt;p&gt;(Second post attempt.)&lt;/p&gt;


	&lt;p&gt;Brett, thank you for your article, though it was highly depressing.&lt;/p&gt;


	&lt;p&gt;I wish someone would write an article that said, &amp;#8220;Hey, programmer: it&amp;#8217;s ok. Your code&amp;#8217;s fine. There are no mounting pressures or decaying skillsets. Relax.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;I suppose they won&amp;#8217;t, though.&lt;/p&gt;


	&lt;p&gt;So I just want to make two off-topic points.&lt;/p&gt;


	&lt;p&gt;1) Current measurements of receding super-novae suggest that the expansion of the universe is accelerating, leading most cosmologist to presume that the universe is open.&lt;/p&gt;


	&lt;p&gt;2) Someone told me once that fingernails don&amp;#8217;t keep growing after death; instead, the body&amp;#8217;s soft tissue dehydrates and shrinks, thus revealing more of the cuticle.&lt;/p&gt;


	&lt;p&gt;Hmm, now the thought&amp;#8217;s just struck me: I wonder what the oldest piece of unchanged but still-used software is? Something like Unix&amp;#8217;s ping, for example. Might we be declaring dead software that&amp;#8217;s really just evolved to perfection?&lt;/p&gt;</description>
      <pubDate>Tue, 06 May 2008 05:02:39 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:4a5be40c-50a2-453f-95ce-50dd36e8e79e</guid>
      <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat#comment-1753</link>
    </item>
    <item>
      <title>"Your code is not flat" by Morbid</title>
      <description>&lt;p&gt;Brett, thank you for your article, though it was highly depressing.&lt;/p&gt;


	&lt;p&gt;I wish someone would write an article that said, &amp;#8220;Hey, programmer: it&amp;#8217;s ok. Your code&amp;#8217;s fine. There are no mounting pressures or decaying skillsets. Relax.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;I suppose they won&amp;#8217;t, though.&lt;/p&gt;


	&lt;p&gt;So I just want to make two off-topic points.&lt;/p&gt;


	&lt;p&gt;1) Current measurements of receding super-novae suggest that the expansion of the universe is accelerating, leading most cosmologist to presume that the universe is open.&lt;/p&gt;


	&lt;p&gt;2) Someone told me once that fingernails don&amp;#8217;t keep growing after death; instead, the body&amp;#8217;s soft tissue dehydrates and shrinks, thus revealing more of the cuticle.&lt;/p&gt;


	&lt;p&gt;Hmm, now the thought&amp;#8217;s just struck me: I wonder what the oldest piece of unchanged but still-used software is? Something like Unix&amp;#8217;s ping, for example. Might we be declaring dead software that&amp;#8217;s really just evolved to perfection?&lt;/p&gt;</description>
      <pubDate>Tue, 06 May 2008 05:00:59 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5f962583-61f3-4e18-9b39-9ecb9b92bb79</guid>
      <link>http://blog.objectmentor.com/articles/2008/05/05/your-code-is-not-flat#comment-1752</link>
    </item>
  </channel>
</rss>
