Playbook · Technical debt and legacy code

Updated

What is technical debt, and when should you pay it down?

Technical debt is the extra work your team pays every week because of shortcuts, old choices or code that was never cleaned up. Pay it down when it slows the work you are doing now, and leave it when it sits in code nobody touches.

In a survey of more than 1,000 developers and 1,000 executives in the US, UK, France, Germany and Singapore, developers estimated they spend 13.5 hours of a 41.1-hour week on technical debt.
Source: Stripe, The Developer Coefficient (with Harris Poll), Sep 2018

Technical debt in plain words

You take a shortcut to ship sooner. The shortcut works, but every later change in that part of the code takes longer. That extra time is the interest. Cleaning the shortcut up is paying back the loan.

Some debt is a good deal. A startup that ships sooner and cleans up right after made the right call. The trouble is the debt nobody wrote down, like the comment that says “TODO: fix later” and has outlived the developer who typed it. That kind keeps charging interest for years.

Where it comes from

  • Shortcuts taken on purpose to hit a date. At least these were a decision.
  • Old choices that were fine at the time: a framework version, a database design, a no-code tool for the MVP.
  • Code that was never cleaned up: dead code, unused libraries, copy-pasted logic.
  • Missing types and tests, so nobody dares to change things.
  • Dependencies left behind until they stop getting security fixes.

How to tell it is hurting you

  • Small changes take days, and nobody can say why.
  • The same bugs come back after they are fixed.
  • New developers take weeks before they ship anything.
  • One part of the code belongs to one person, and everyone else walks around it.
  • Upgrades get postponed because they "might break something".

When to pay technical debt down

  • When it sits in code you change every week. That is where the interest is paid.
  • When it is a security risk: hard-coded keys, unpatched libraries, a framework version with no more security updates.
  • Before a raise or a sale, because a due diligence review will find it.
  • Before you grow the team, because every new developer pays the interest too.

When to leave it

Old code that works and that nobody needs to change can stay as it is. It may be ugly. Ugly code that nobody opens costs you nothing, and cleaning it costs time. I would leave it. The same goes for a product you are about to replace. Pay down the debt that is in your way. The rest can wait.

How to pay it down without stopping the roadmap

  • List the debt with a rough cost to fix, the same way you list features. Debt that lives only in the developers’ heads never gets a budget.
  • Fix it where you already work: when a ticket touches messy code, clean that part as part of the ticket.
  • Keep a fixed share of each sprint for it, so it never waits for a quiet month that never comes.
  • Do the big items, such as a framework upgrade, as a planned project in steps.

Read next

Sources

Start

Tell me where the product is stuck.

In 30 minutes we look at where things stand, what you need from a CTO right now, and which option fits. Either way, you leave with a clear next step.

How the call goes

  1. 01You tell me about the product, the team and the next 6 months.
  2. 02I ask about the code, the stack and what keeps breaking.
  3. 03We pick the option that fits, or agree that none does.

09:00 to 20:00 CET

Founding rate: the first 3 clients get 20% off, in return for a named testimonial and a case study. On a monthly plan, the 20% applies to the first month.