The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Is Messy Code a Technical Debt?

18 replies on 2 pages. Most recent reply: Oct 23, 2009 12:52 PM by John Zabroski

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 18 replies on 2 pages [ 1 2 | » ]
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Is Messy Code a Technical Debt? Posted: Oct 14, 2009 10:39 PM
Reply to this message Reply
Advertisement

The term "technical debt" was coined by Ward Cunningham to describe trade-offs a team makes to achieve certain project deadlines. Since most projects must meet milestones and deadlines, developers on a project can't spend an infinite amount of time improving their code. The result is technical debt that must eventually be paid off.

In a pair of blog posts, Uncle Bob and Martin Fowler illuminate the kinds of technical debt that every project faces.

In A Mess is not a Technical Debt, Uncle Bob notes that making compromises is often necessary to meet project deadlines. But he distinguishes design trade-offs from just plain carelessly written code:

A mess is not a technical debt. A mess is just a mess. Technical debt decisions are made based on real project constraints. They are risky, but they can be beneficial. The decision to make a mess is never rational, is always based on laziness and unprofessionalism, and has no chance of paying of in the future. A mess is always a loss...

The more technical debt you take on, the tighter your disciplines need to be. You should do more testing, and more pairing and more refactoring. Technical debt is not a license to make a mess. Technical debt creates the need for even greater cleanliness... When you decide to take on a technical debt, you had better make sure that your code stays squeaky clean. Keeping the system clean is the only way you will pay down that debt...

In TechnicalDebtQuadrant, Martin Fowler writes that he considers messy code also as a technical debt, but one committed to inadvertently. Fowler then describes four types of technical debt: Deliberate/reckless, deliberate/prudent, inadvertent/reckless, and inadvertent/prudent:

The useful distinction isn't between debt or non-debt, but between prudent and reckless debt...

Not just is there a difference between prudent and reckless debt, there's also a difference between deliberate and inadvertent debt. The prudent debt example is deliberate because the team knows they are taking on a debt, and thus puts some thought as to whether the payoff for an earlier release is greater than the costs of paying it off. A team ignorant of design practices is taking on its reckless debt without even realizing how much hock it's getting into.

Fowler notes that a special case of technical debt is both inadvertent and prudent:

It's often the case that it can take a year of programming on a project before you understand what the best design approach should have been. Perhaps one should plan projects to spend a year building a system that you throw away and rebuild, but that's a tricky plan to sell. Instead what you find is that the moment you realize what the design should have been, you also realize that you have an inadvertent debt.

Do you believe that messy code and quick-and-dirty implementations are a form of technical debt? Or, are they just the results of poor practices that can be avoided regardless of deadline pressures?


John Wellbelove

Posts: 72
Nickname: garibaldi
Registered: Mar, 2008

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 12:52 AM
Reply to this message Reply
You always pay the cost of messy code and quick-and-dirty implementations later. The time you save doing them is usually outweighed by the extra time you require later on untangling the mess in order to add the next feature. This puts even more pressure on the coder to do yet another quick-and-dirty implementation, and so the cancer grows.
As Uncle Bob said, it's not a technical debt, it's laziness and unprofessionalism.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 6:26 AM
Reply to this message Reply
> You always pay the cost of messy code and quick-and-dirty
> implementations later.
> ...
> As Uncle Bob said, it's not a technical debt, it's
> laziness and unprofessionalism.

If you have to pay for it later, it's debt. I don't see why the reason it was created matters with regard to that. Whether I incur buying a house with a mortgage or by buying a round of drinks for the bar on my credit card, it's debt.

Nemanja Trifunovic

Posts: 172
Nickname: ntrif
Registered: Jun, 2004

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 7:39 AM
Reply to this message Reply
> Whether I incur buying a house with a mortgage or by
> y buying a round of drinks for the bar on my credit card,
> it's debt.

But the former is usually considered "good debt", while the later is "bad debt" or even "financial cancer".

John Zabroski

Posts: 272
Nickname: zbo
Registered: Jan, 2007

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 7:45 AM
Reply to this message Reply
> <p>Do <em>you</em> believe that messy code and
> quick-and-dirty implementations are a form of technical
> debt? Or, are they just the results of poor practices that
> can be avoided regardless of deadline pressures? </p>

Who cares what I think.

Martin breeds trust, and non-technical people are proven to understand him.

Thus, I will save the article from Fowler and chuck the one from Bob. When I need to explain such a scenario, it will be useful to read.

I'm surprised APress hasn't approached Fowler about doing a Best of Joel on Software style book for his bliki. Granted, a lot of the bliki's are expanded on with full books by other authors in Fowler's "signature series" from AW.

John Zabroski

Posts: 272
Nickname: zbo
Registered: Jan, 2007

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 7:54 AM
Reply to this message Reply
> Who cares what I think.

One minor detail:

The greatest form of technical debt I see is framework creation.

It is important to realize when you are building something so huge that it requires developers who have:

a) capacity
b) will

...to do it.

If you don't, then you may need more capacity or a change of people, or both. Or you can avoid the problem by deciding the opportunity costs just don't make sense, because the features planned for your large framework will only ever be used by 5% of your customers.

In-house vs. open source is the most frequent technical challenge we face where I work. Customer solutions are easy. Creating software factories and software product lines is hard. Open source is just so cheap these days that anything in-house is a technical debt, and has to be paid back for with improved service to customers that gives us an edge in the marketplace.

Bottom line: If you're talking about debt, you're discussing a business matter, not a technical matter. This is strategic. Deliberate/reckless debt in this sense is simply the result of either (a) insane management in their first software rodeo (b) untrained, unskilled, untalented developers who don't understand OO and normal forms, as well as other techniques such as model checking.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 9:29 AM
Reply to this message Reply
> > Whether I incur buying a house with a mortgage or by
> > y buying a round of drinks for the bar on my credit
> card,
> > it's debt.
>
> But the former is usually considered "good debt", while
> the later is "bad debt" or even "financial cancer".

No argument here but when you look at financial statements, the only thing that matters is assets vs liabilities. It doesn't matter how the liabilities are incurred or whether they are tied to assets. Debt is debt. Back to the topic at hand, if you have incurred technical debt, the reason why it was incurred doesn't matter. What matters is what you are going to do about it. The idea is to avoid debt as much as possible. Since messy code is easily avoided, it makes no sense to take on that debt. But it happens and when it does it's debt, and it has a cost.

I also question the contention that technical debt taken on consciously is equivalent to good debt. Good debt is associated with an asset that counters the liability. I have a mortgage but my house is worth more than my outstanding balance. My net worth is positive. Conscious technical debit is more like buying groceries with a credit card because you don't have the cash, get paid tomorrow and don't want to tap into your savings. That doesn't make it good debt. It's just a rational decision to take on bad debt knowing ypu can pay it off before interest is charged. If I don't do that, I'll pay interest at the same rate as if I used it at the bar. If you take on technical debt by choice, you still have an issue to contend with just as if you end up with messy code.

This might seem like semantics but I run into issues where I currently work with regard to this. When a issue with a design is noted, often those involved will quickly point out why it was necessary based on some external factor. Frankly, I really don't care why it's bad. It's a problem that needs to be addressed. It's a waste of time to dissect problems and determine their origin (aside from determining requirements they may currently satisfy.) The focus should be on resolving the issues.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 9:36 AM
Reply to this message Reply
> Who cares what I think.

I care. I might even care more about what you think than I care about what Martin Fowler and Uncle Bob think now that you ask.

I'm not trying to kiss your ass or anything; you're just being too humble and it's annoying to me.

John Zabroski

Posts: 272
Nickname: zbo
Registered: Jan, 2007

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 12:07 PM
Reply to this message Reply
> > > Whether I incur buying a house with a mortgage or by
> > > y buying a round of drinks for the bar on my credit
> > card,
> > > it's debt.
> >
> > But the former is usually considered "good debt", while
> > the later is "bad debt" or even "financial cancer".
>
> No argument here but when you look at financial
> statements, the only thing that matters is assets vs
> liabilities. It doesn't matter how the liabilities are
> incurred or whether they are tied to assets. Debt is
> debt.

Well, sort of. Liabilities are independent of assets so that you can measure how much liabilities a company has, even in the event that it has overstated earnings and must do accounts receivable write-offs. What matters is leverage and at-risk. If your country has 1 trillion dollar deficit, it doesn't matter if their GDP is growing faster than that deficit (how much they owe other nations). This is what kept the US economy booming for basically all of Greenspan's tenure as chairman of the fed reserve, as compared with other nations like Britain.

Also, at the business level, some companies can do some truly weird stuff with regards to assets.

Case-in-point, FAST.

I always enjoy reading Mark Logic CEO Dave Kellogg's blog. In particular, his old rants on FAST:

http://marklogic.blogspot.com/2007/07/fast-search-transfer-warns-big-time.html

http://marklogic.blogspot.com/2007/08/fast-search-train-wreck-whos.html

http://marklogic.blogspot.com/2007/07/more-on-fasts-extensive-profit-warning.html

http://marklogic.blogspot.com/2008/05/fast-troubles-still-linger.html

and the best two:

http://marklogic.blogspot.com/2007/08/fast-search-blood-letting-begins.html

http://marklogic.blogspot.com/2008/06/blind-eyes-industry-analysts-and.html

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Is Messy Code a Technical Debt? Posted: Oct 15, 2009 12:28 PM
Reply to this message Reply
> Also, at the business level, some companies can do some
> truly weird stuff with regards to assets.

I purposely over-simplified things because the technical debt metaphor can't be stretched very far.

The point is that teams don't take on technical debt because it allows them to acquire something that offsets that cost. I can't think of any example, at least. If you have one I'm open to it.

The reason we take on technical debt is for compromise. We decide that the cost of the technical debt will be incurred because it allows for some other constraint to be satisfied. The assumption is that the technical debt represents something that need to be fixed. It's never a positive. What is meant by good debt is that you want to have it, for example taking out a loan to make money. We never want to have technical debt.

If you are taking on cost in order to achieve something that offsets that cost in technical terms (perhaps over time and/or with some degree of risk), that's not what I would call 'technical debt'. I've never seen anything that suggested that it was.

Raoul Duke

Posts: 127
Nickname: raoulduke
Registered: Apr, 2006

Re: Is Messy Code a Technical Debt? Posted: Oct 19, 2009 4:31 PM
Reply to this message Reply
> The assumption is that the technical debt
> represents something that need to be fixed. It's never a
> positive.

metaphors break down at some point. debt that is about money is about something fungible. technical debt is different. it is a positive in that one gets the product out sooner and beats competitors who then go out of business, rather than you yourself going out of business (as one hypothetical situation/rationalization for taking on the debt). but it is hard to make back the money to then magically make the technical debt evaporate. no, the profit would have to be plowed back in, along with a lot of time and effort, to deal with the technical debt, which would prevent you from making new headway. and so the technical debt rarely gets paid off.

etc.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Is Messy Code a Technical Debt? Posted: Oct 19, 2009 6:36 PM
Reply to this message Reply
> metaphors break down at some point. debt that is about
> money is about something fungible. technical debt is
> different. it is a positive in that one gets the product
> out sooner and beats competitors who then go out of
> business, rather than you yourself going out of business
> (as one hypothetical situation/rationalization for taking
> on the debt). but it is hard to make back the money to
> then magically make the technical debt evaporate. no, the
> profit would have to be plowed back in, along with a lot
> of time and effort, to deal with the technical debt, which
> would prevent you from making new headway. and so the
> technical debt rarely gets paid off.

Of course t makes sense to sometimes take on technical debt. I make no argument to the contrary. What I take issue with is the idea that messy code isn't debt. It clearly is. It's something that you will have to contend with; either by fixing it or dealing with the drag on productivity. I understand the sentiment but I think the result is opposite to the desire. People will get the idea that messy code doesn't matter if you say it isn't technical debt. The only thing that's different with messy code is that it doesn't ever provide any side benefit or at least that is what is argued. In other words, there is no rationale for it. I don't (mostly) disagree.

John Wellbelove

Posts: 72
Nickname: garibaldi
Registered: Mar, 2008

Re: Is Messy Code a Technical Debt? Posted: Oct 20, 2009 12:54 AM
Reply to this message Reply
Maybe we should say that a 'messy code' solution is a double debt.
The technical debt is a conscious decision to design something in a particular way involving a (temporary?) compromise of the ideal solution. Messy code is an undesirable implementation of that compromise which adds unnecessary debt.

Raoul Duke

Posts: 127
Nickname: raoulduke
Registered: Apr, 2006

Re: Is Messy Code a Technical Debt? Posted: Oct 20, 2009 10:58 AM
Reply to this message Reply
yeah, i'm just trying to say that even regular technical debt of the best kind is still worse than debt in terms of money, because money is fungible and can be paid off the instant you get the profit, whereas the instant you get the profit you cannot snap your fingers and have the technical debt go away.

so i kinda think the technical "debt" metaphor can easily be misleading, can make people feel it isn't as bad as it really is.

Harrison Ainsworth

Posts: 57
Nickname: hxa7241
Registered: Apr, 2005

It needs a a better model Posted: Oct 22, 2009 9:39 AM
Reply to this message Reply
A more sophisticated model is needed to evaluate these questions in any useful way.

Whether bad code is a cost depends on its situation and status regarding evolvability: a simple metric might be: how likely the code is to be modified, and what kind of modifications will be done. If code is never touched again, or is deleted and replaced wholesale, no cost is incurred. The rest of the range is probabalistic.

Since a map of such 'evolvability properties' is plausibly based on simple metrics and statistics, it is reasonable that it could be developed to some useful level.

Even without that, experienced judgement on the job should be able to do better than declaring all dodgy code one extreme or the other.

Flat View: This topic has 18 replies on 2 pages [ 1  2 | » ]
Topic: What are Your JUnit Pain Points, Really? Previous Topic   Next Topic Topic: VisualVM 1.2 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use