“Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite… The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation, object-oriented or otherwise.”
– Ward Cunningham, 1992
Most recently technical debt is
The definition I’ll use is the following:
Technical debt occurs when a design or construction approach is taken that’s expedient in the short term, but that creates a technical context that increases complexity and cost in the long term.
Again, in modern software process, incurring debt can be a good thing, if it means you ship software and meet deadlines.
For example, what is the value of a Valentine’s promotion that is released Feb 15?
Martin Fowler has a quadrant that outlines this: 
Philippe Kruchten (UBC, Rational Software) has a nice conceptualization of the role technical debt plays in software development.
TD is seen as an invisible, negative value for your code. Again, in the extremely short term TD is not bad. It become bad as time passes and the debt accrues.
We call the impact of accrued debt interest, which refers to the ongoing added costs you have to pay.
This can be in terms of longer release times, longer test runs, cognitive burden on developers, or other measures of impedance caused by imperfect code.
Managing technical debt comes down to two things.
This can be as simple as changing a variable name, or as complex as adding or removing files and classes (if the ‘refactoring’ turns into something more complex, it is really about re-architecting, and deserves different treatment, unless your codebase and devops infrastructures are really solid).
The following chart shows how we might see TD as a ‘drift’ between some ideal state (high value) and the actual state.
How do you find technical debt? Kruchten argues for explicitly tracking the debt.
However, in many cases the debt has been incurred a long time ago, and all you know now is that things suck (high interest costs).
There is a continuum of “bad practices” from the code level up to the design level.
Tools can capture many of these.
But as we move ‘down’ the taxonomy, the clarity of the violation is reduced (harder to justify), and the ability for a tool to detect it becomes harder.
Think about how one might catch a buffer overflow error, vs designing code that doesn’t even use array indices.
Self-admitted technical debt (SATD) is a term coined by Emad Shihab to capture comments in the code that ‘admit’ that a particular approach is a hack, or poor form.
In some cases it might be captured in a tool, but it is unlikely. They aren’t bugs; the code works. Just not as ideal as one might hope.
Grepping for these comments can be a good way to find TD. Just ensure it is architecturally interesting. The obvious downside is some code style guides explicitly frown on these types of comments.
Some examples of tools include linters like Pylint, code smell analysis tools like Findbugs, and the platform analysis tools (which incorporate all sorts of analyses) like SonarQube and Codescene.
At the end of the day, as a tool user, you should keep the following in mind:
toolvssmell

Neil Ernst ©️ 2024-5