Monday, November 2, 2015

We need a better metaphor than technical debt



When I first heard of the term “technical debt”, I was thrilled. I thought finally I could use the term to explain to my management, who had either little or out-of-dated technical understanding and had little patience to anything other than resources (yep, software engineers are just one of the resources) and budget, why smelly code was bad. I could say to them, “look, it is like a financial debt, if we don’t pay off, it will become larger and larger, and in the end, we will only be paying off the interest, there is no hope that we can every pay back the principle”.

The management listened politely and nodded – so obviously, this was a metaphor that they understood. But they were not galvanized, they didn’t jump up in shock and immediately rolled up sleeves to assemble “resources” to do refactoring. 

I later realized that I was asking too much with this metaphor. It is simply human nature to be optimistic and reckless. You know this when you see in news that someone has multiple credit cards and uses one credit card to pay off the other. There is this sweetness in human nature that keeps us going on, thinking that “just let me go through this week, this month, and everything then will come out ok.”

Comparing technical debt to financial debt has the same effect. When things get tough in a project (which always happen), it is tempting to just borrow some more and get through this release – we will definitely pay back the debt in the next release. 

So I think we need a better metaphor. Since everyone knows smelly code, how about comparing it to rotten food in a refrigerator? If the rotten food is not thrown away, it will contaminate other food in the refrigerator, and things can get so bad that the whole refrigerator might have to be thrown away – the whole project has to be cancelled or the system be abandoned. 

It is ok to keep some food that is beyond its shelf life -- if we are really hungry and if there is no other food, we just need to keep in mind the consequence of neglecting it for too long; and also some smelly food can also be quite delicious, for example, the smelly Tofu, so we should make intelligent decisions depending on the context. 

Some management might be creative and try to work around the rotten food by throwing it into the freeze compartment, which actually is a good way to handle smelly code: if we can’t refactor it cost-effectively, let us isolate it so that it won’t affect other parts. The worst thing we can do with smelly code is to mix it with new code, and thus contaminate the whole system.

I just hope that there is way to measure how smelly the refrigerator is. We have a way to measure how hot a pepper is, can't we have a measure how smelly some food is? We can say, it is 10 unit smelly, we can tolerate it; it is 1000 unit smelly and it makes people sick, we have to do something about it.

Here is how rotten food in a refrigerator looks like:

With this, I hope I have ruined your appetite :-)

1 comment:

  1. See broken windows theory too :)
    https://en.wikipedia.org/wiki/Broken_windows_theory
    []'s

    ReplyDelete