Technical debt
Technical debt is the mistakes and poor decisions accumulated in code because at the start it is unknown how exactly a user will behave. A team builds a product on assumptions and ships code, and after the hypotheses are tested some of the assumptions turn out to be wrong. The main technical debt is born from wrong integrations: the borders between parts of the system are drawn on an assumption, and if it is wrong, the parts are glued together where the real border of the business domain does not lie. This is a wrong split into bounded contexts: the words and data of one context have to be translated constantly into the language of its neighbour, a change in one place drags changes in others, and every new integration adds to the debt. The code written for wrong assumptions stays, and every new change is made on top of it: it becomes more expensive and riskier. As with money debt, technical debt has interest: the longer it is left unpaid, the more time any change takes. Part of the debt is taken on purpose to reach the market faster (time-to-market), and then it is paid back after the hypotheses are tested: the code is rewritten for what turned out to be true.
Frequently asked questions
What is technical debt?
Mistakes and poor decisions accumulated in code because at the start it is unknown how a user will behave, and some of the assumptions turn out to be wrong after testing.Where does technical debt come from?
From assumptions the team makes while it does not yet know how users behave. Testing hypotheses disproves some of them, but the code written for them already works and other parts rely on it.Why is it called a debt?
Like money debt, it has interest: until the code built on wrong assumptions is rewritten, every new change costs more and more often breaks neighbouring parts.How is technical debt paid down?
The code built on disproved assumptions is rewritten or removed in small steps alongside regular work, and the rewritten part is covered with automated tests.How is technical debt related to unit tests?
Code with debt has few pure functions: the logic is mixed with calls to a database and the network. So it has to be tested with mocks and rewritten together with tests.How is technical debt related to bounded contexts?
The main technical debt is born from wrong integrations, that is, from a wrong split into bounded contexts. If the borders are drawn where the border of the business domain does not lie, the contexts constantly exchange data and translate each other’s words, and any change touches the neighbours.Source: Martin Fowler: Technical Debt