Skip to content

Refactoring Contagion Runs Amok

2010/07/29

BREAKING NEWS: Virulent pathogen loose amidst helpless methods, attacks cruft.

by Arua Lee Thacker

While performing extensive characterization testing on a particularly poorly written section of code, a software developer somewhere in the Midwest (who wishes to be known in this instance as @foo) inadvertently reduced his immunity to a common malady known as the Refactoring Bug, resulting in a loss of approximately 50% LOC in the region of the application where he was working.

The daring @foo did his best to exercise restraint, but due to the extraordinarily hideous nature of the code he had been working on of late, his resolve was weak.  As a result, his resistance to the pathogen had fallen to dangerously low levels.

For that reason, after gaining much insight the intent of the code through the aforementioned characterization tests, @foo was able to write some unit tests which exposed a flaw in the implementation.  That is when the refactoring bug took hold.

As he fixed the bug, @foo carefully changed first this section, then that, slowly getting the tests to pass and cleaning up after the evil ways of $previous_dev, who @foo later explained had long been his arch-nemesis.  He claims that the vicious refactoring onslaught began immediately after all of the tests were passing.    “I couldn’t resist.  It was so hideous, and it was doing too much, working too hard, you know?  I just had to make it right!”  he admitted sheepishly.

“In a single furious moment of code vengeance, the refactoring bug laid siege and laid waste to my willpower, and the code.  I was hacking and slashing, tests passed, then failed, then passed again.  It was surreal.  Then, just as quickly as it begin, the mania subsided, a peaceful feeling of calm satisfaction washed over me, like a warm blanket.  It was so nice, looking at the clean, clear new implementation, the reassuring green of passing tests, the concise, easy-on-the-eyes structure of the newly rewritten code.  I was happy.”

Fortunately for @foo, it was precisely at that moment that the impetuous little refactoring bug moved along to find another suitable host.  It is purported that this strain of the refactoring virus thrives in hosts who are energetic and enthusiastic about their work.  Experts also claim that fervent learners, especially those with hyperactive or obsessive compulsive tendencies are more susceptible to infection.  If you are such an individual, you should be aware that at any moment you may be attacked.  Signs of infection include, but may not be limited to an untenable urge to unleash a cleaning frenzy on a few (or several) of the seemingly infinite lines of terrible code that $previous_dev(s) have left strewn haphazardly amidst the expansive wasteland commonly known as software.

Presently, no antidote is known, and the virus is considered extremely contagious.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: