Changelogic weblog

Nonlinearities of software development
  

Is refactoring economically justified?

August 14th, 2006 Karel Kravik

Villu Ruusmann, programmer, Changelogic: “Why are we committing these jar files to CVS? This is such a waste! We should keep them in Maven repository.”

Karel Kravik, product manager, Changelogic: “Why? How much costs this extra 200KB?”

Villu Ruusmann: “C’mon man, this just isn’t elegant solution! It needs serious refactoring.”

Karel Kravik, mumbling angrily: “Yeah, exactly. Elegance. Refactoring. J2EE, XML, BMW.”

What do we know that Villu doesn’t? And what does Villu know that we don’t?

Villu knows that setting up Maven repository and configuring your project to use it will take 8 hours.

What he doesn’t know is that 8 hours of his time will cost us, let’s roughly guess, €100. What he can calculate, but it doesn’t come to his mind, is that 200KB of disk space will cost as much as €0.00057 (assuming you can get 70GB for €200, probably even cheaper since I don’t follow the prices). Even if we store that 200KB file in CVS for 3000 times, it still costs us - only - €1.7.

So where exactly is the elegance in paying €100 to save €1.7?

Alternative cost

Poor Villu, we are still not finished with him. What can Villu do with 8 hours?

Imre Lumiste, senior programmer, Changelogic: “He could fix some bugs.”

Karel Kravik: “Oh really. What bugs do we have?”

The Answer I Would Like To Hear: “We have here bug number 3828, which is causing every 10th client turning down our software. Of course everybody knows that an average client will bring us €5000 a year. At the moment we have 10 potential clients per day, so we’re losing €5000 every day. The problem is identified; it takes 8 hours to fix.”

But what is the real answer? It goes something like this:

Imre Lumiste: “We have here bug number 3828. This is some strange memory leak in our transaction engine that is probably caused from miscommunications with the database driver so that every once in a while a transaction is timed out. We have to investigate it carefully and maybe even contact the vendor support.”

Mmm-mmm, what else can we do with €100?

John B., marketing director: “Hey man, this is our moment! I just got an offer to advertise our product on the first page of Arvutimaailm. And it’s only €99.”

Suppose I am not very technical person (that’s sad, but true) and the memory leak leaves me somewhat untouched as I didn’t get the Answer I Would Like To Hear, so I decide to spend my €100 on marketing and buy the advertisement in Arvutimaailm (Computerworld, Estonian PC Magazine).

What I don’t know yet, is that CEO of Krakozhia Programming Farms, Slobodan Skradin (older brother of Milan Skradin, CIO of Krakozhia Telecom, which outsources all development to Krakozhia Development Farms) will find this issue of Arvutimaailm on the plane seat next to him on his flight from London to New York and as the Changelogic commercial is the only dang thing in the language he can understand, that is, English, as the rest of the content being in some strange Eastern European dialect called Estonian, it grabs his attention.

The rest is history. After a month he signs an agreement to purchase no less than 3500 (it is what the name suggests - a farm!) Changelogic licenses along with another 650 grand worth of consulting, customizations and on-site training.

This is a single biggest software deal in Estonia after Skype founders got rich, which, in turn, doesn’t count because they sold their company, not their software.

Karel Kravik, in the cover story of Äripaev (Business Day, Estonian Wall Street Journal): “I’m telling my team every day that you must have clear priorities set.”

Nassim Taleb, Fooled By Randomness: “Lucky fool.”

We are option blind

Backspin.

Mister Krakozhia Programming Farms missed that plane; Arvutimaailm was never left on his neighbor seat because there was a small delay because of jammed printer so the plane left even earlier than first Arvutimaailms were carried out to subscribers. So it didn’t even reach the guy who could have left it in that plane. Nobody else looked at the commercial longer than it takes to turn the page.

Backspin.

You’re still in a point when you have to make the decision. You don’t know which scenario will become true, you can only guess.

Steve Jobs, Stay Hungry, Stay Foolish: “You can’t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something-your gut, destiny, life, karma, whatever.”

Nassim Taleb: “[This is what I call] Narrative Fallacy. Creating a story post-hoc so that an event will seem to have a cause.”

Problems with optimal choices

Firstly, people are probably not even aware of the options they can choose between. For example, I’m pretty sure, most of the technical staff will insist on fixing the bugs before continuing with new developments. Basically that is not bad, but there still has to be an economic justification. Some seasoned development leads choose between bugs and new features, but they never think that maybe they could use available resources in some area where they aren’t involved as day job, for example marketing.

Karel Kravik: “I have seen people fixing a ’serious flaw’ which consists of optimizing 10% something that takes 0.5% of overall request time and are happily unaware of whatever takes the rest 99,5%.”

Secondly, people are not aware of the optimization criteria; they cannot make the best decisions just because they don’t even come close to be aware of what the right optimization criteria might be. For techies it may be some kind of abstraction, optimization, refactoring, the Elegance of the solution.

Although, when your product ships, it’s very likely that nobody cares about the Elegance, except if the Elegance is the part of the solution; something included in your sales pitch. If you optimize a video game to run really fast, it’s justified, saving 200KB of disk space nowadays is not unless you’re optimizing Linux to run from 1.44′’ diskette.

Karel Kravik: “Sometimes this is due to poor communication, but during a lot of debates I’ve been holding, people simply do not accept the argument of economic justification.”

Raakel Kaakiv, Karel’s alter ego: “Maybe this is because the hype is blind, you either do refactor or don’t, 1 or 0. Actually there a full scale between them. What complicates the problem is that the scale is highly context dependent, what works in one project or team, won’t do in others.”

Rakuke Kakuke, Karel’s another alter ego, a better one: “Typically innovative things are not economically justified from day one.”

Raakel Kaakiv: “Would you be still in business after a year if all you do is innovation? Would the decision be simpler if you knew that your chances of success are 1:1 000 000 when you’re innovating and 1:100 if you spend your resources in a bit more risk averse way?”

Rakuke Kakuke: “Define what is more risk averse! I see no risk because I haven’t put a single penny in this business.”

Let’s leave these guys arguing, it’s usual, and see what happens if we knew the right optimization criteria.

Thirdly, people are not very good at evaluating the options they have. That is not because of these people were incompetent or plain fool, but because the outcomes are often unpredictable. Even worse, they represent the kind of unpredictability where you cannot calculate your odds.

And still, at the end of the day, you have to make choices.

Despair Inc, Indifference: “It takes 43 muscles to frown and 17 to smile, but it doesn’t take any to sit there with a dumb look on your face.”

Making it easy

Karel Kravik: “Just bringing out the key points this messy rant was about.”

So when you have to choose between multiple options ask yourself:

  1. Is this the full set of options? Do you see the whole picture?
  2. What are the actual criteria you’re evaluating your options against? Do you see the whole spectrum of criteria?
  3. Can you evaluate the alternatives? Can you predict the whole chain of events that will unfold after your decision?

Here is a little hint about the ultimate optimization criteria: 

Joel Spolsky: “The real goal for software companies should be converting capital into software that works.”

Entry Filed under: Handling Uncertainty

WordPress database error: [Can't open file: 'wp_comments.MYI' (errno: 144)]
SELECT * FROM wp_comments WHERE comment_post_ID = '11' AND comment_approved = '1' ORDER BY comment_date

Leave a Comment

Required
Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

 

WordPress database error: [Can't open file: 'wp_slim_stats.MYI' (errno: 145)]
INSERT INTO wp_slim_stats ( `remote_ip`, `language`, `country`, `referer`, `domain`, `searchterms`, `resource`, `platform`, `browser`, `version`, `dt` ) VALUES ( "644595540", "en-us", "us", "", "", "", "/weblog/2006/08/14/is-refactoring-economically-justified/", "-1", "34", "", "1269043829" )