Essay

The Philosophy of Technical Debt

When to take on technical debt, when to repay it, and how to talk about it in system design and behavioral interviews.

Swati S.10 min read

TL;DR: Technical debt is a tool, not a moral failing. Strategic debt is chosen with a plan; accidental debt grows unseen. Repay when the feature is stable, the team is growing, or interest is compounding, and write down what you deferred so it becomes a task instead of a mystery bug. In interviews, name the debt you are choosing and say when you would repay it.

Loop showing technical debt: take a shortcut, interest builds as slower changes, then repay or keep borrowing, with an orange arrow looping back to borrow again
Every shortcut starts a loop, and you choose at each turn whether to repay or borrow again.

Technical debt is a metaphor, not a moral failing. Sometimes taking on debt is the right choice. You ship faster. You learn from users. You discover what actually needs to be built. The alternative, building everything perfectly, often means building the wrong thing.

I've seen teams spend months building the "perfect" system, only to discover users wanted something completely different. By the time they shipped, the market had moved on. They built the right thing the wrong way, which is worse than building the wrong thing the right way.

The question is not "Should we have technical debt?" The question is "Is this debt serving a purpose?"

This essay is an opinion, based on patterns I've seen. It covers how to decide, how to track, and how to talk about debt, including in interviews. It does not cover specific refactoring techniques or tools. Your team's size, product stage, and risk tolerance will change the answers.

Distinguish strategic from accidental debt

Strategic debt is intentional. You know it exists. You have a plan to address it. You took it on to hit a deadline, validate an idea, or simplify a prototype. The interest is calculated.

Accidental debt is what happens when you don't know better. You used a framework without understanding it. You copied code without reading it. You deferred a decision until it disappeared. This debt compounds silently.

I once inherited a codebase with massive accidental debt. The original engineer had copied patterns from Stack Overflow without understanding them. The code worked, but it was unmaintainable. Every bug fix created two new bugs. The interest rate was enormous.

Strategic debt you can manage. Accidental debt manages you. The first is a tool. The second is a trap.

Notice that the same line of code can be either one. A shortcut someone chose and wrote down is strategic. The identical shortcut, found a year later with no note, is accidental, because nobody remembers the reason or the plan. The difference is the paper trail.

Know when to pay down

Not all debt needs immediate repayment. A prototype that worked becomes production code. The debt was justified. But once you know the feature is staying, pay it down. Refactor. Add tests. Document assumptions.

Pay down debt when:

  • The feature is stable: You know what it needs to do. Requirements aren't changing.
  • The team is growing: New engineers need clarity. Unclear code becomes a bottleneck.
  • The interest is compounding: Bugs are frequent. Changes are risky. Velocity is slowing.

Don't pay down debt when:

  • You're still exploring: Features may change. Refactoring now is wasted effort.
  • There's higher-priority work: Users are waiting. Shipping new features provides more value.
  • The debt isn't causing problems: If it works and changes are infrequent, leave it alone.

I've seen teams spend weeks refactoring code that never changes. That's wasted effort. I've also seen teams ignore accumulating debt until every change breaks something. That's shortsighted.

The key is to track the interest rate. Is it increasing? Are changes getting harder? Is velocity slowing? If yes, it's time to pay down. The same restraint applies to building ahead of need, which is what YAGNI warns against. Over-building early is its own kind of debt.

Document the debt

When you take on debt, write it down:

  • What did you defer?
  • Why did you defer it?
  • What's the plan to address it?
  • What's the risk if you don't?

A documented debt becomes a task. An undocumented debt becomes a mystery bug. I keep a "debt log" for every project. It's not a shame list. It's a backlog. Each entry is a conscious decision, not an oversight.

A good entry takes two minutes. "Hard-coded retry count of 3 in the payment client. Deferred to ship by Friday. Revisit when we add a second payment provider. Risk: a provider outage drops orders." That's enough for someone who joins next year to understand the choice. It also gives you something to show a manager when you ask for repayment time.

Debt accrues interest

The longer you wait, the harder it gets. Code that was "good enough" becomes "unmaintainable." Quick fixes become architecture. Workarounds become features.

Track the interest rate. How much slower is development? How many bugs are related? How hard is onboarding? When interest exceeds principal, pay it down.

I once worked on a codebase where adding a new feature required touching code in twelve different places. The original design hadn't considered extensibility. The debt had accrued so much interest that every change was risky. We spent six months refactoring, but we had to. The interest was unsustainable.

You can measure interest without fancy tools. Count how many files a typical change touches. Note how often a release needs a hotfix. Ask how many days a new hire needs before the first merged change. Three numbers, tracked monthly, tell you more than a debate does.

Think in terms of leverage

Good architecture is leverage. It makes future work easier. Debt reduces leverage. It makes future work harder. The question is: "Does this debt reduce our leverage below acceptable levels?"

If you can still move fast, the debt is manageable. If every change feels risky, pay it down. If onboarding takes weeks instead of days, pay it down. If bug fixes create new bugs, pay it down.

I measure leverage by asking: "How long would it take a new engineer to make a meaningful change?" If the answer is weeks, leverage is low. If the answer is days, leverage is acceptable. If the answer is hours, leverage is high.

Debt that reduces leverage below acceptable levels needs immediate attention. Everything else can wait. This is the same habit as trade-off thinking: you're not asking "is it clean?", you're asking "what does it cost us, and is that cost worth it?"

Debt has different types

Not all debt is equal. Some debt is easy to pay down. Some is hard. Some is very hard.

  • Easy debt: Missing tests, unclear naming, undocumented functions. These can be fixed incrementally.
  • Medium debt: Tight coupling, missing abstractions, performance issues. These require focused effort.
  • Hard debt: Architectural decisions, fundamental design flaws, technology choices. These require significant refactoring.

Prioritize easy debt first. It gives you quick wins and improves code quality without major effort. Then tackle medium debt when you have focused time. Hard debt should be planned like a feature. It needs design, time, and buy-in.

Hard debt is where gradual replacement beats a big-bang rewrite. The strangler pattern and the step-by-step monolith to microservices story show teams repaying architectural debt in small, safe slices.

Debt compounds in different ways

Some debt compounds slowly. A codebase without tests gets harder to change, but the degradation is gradual. Some debt compounds quickly. A system without proper error handling will fail catastrophically under load.

Fast-compounding debt needs immediate attention. Slow-compounding debt can wait a little. The trick is knowing which is which.

I once ignored slow-compounding debt (lack of tests) to focus on features. After a year, every change was risky. I had to spend months adding tests just to be able to change code safely. The debt had compounded beyond what was manageable.

A simple sort: ask "what happens if this fails in production next week?" If the answer is an outage or lost money, it compounds fast. If the answer is "someone is annoyed," it compounds slowly. Production failures like the N+1 query crisis are what fast-compounding debt looks like when it finally comes due.

Debt has context

The same code might be debt in one context but acceptable in another. A quick script that runs once doesn't need the same quality as production code. A prototype doesn't need the same architecture as a long-lived service.

Context matters. Don't apply the same standards everywhere. Know when quality matters and when it doesn't.

Context also includes people. A shortcut that one engineer understands completely is cheap while that engineer stays. It becomes expensive when they leave. Ask who else can read it, and let that answer set how much you write down. This is also why reading production code is such a useful skill: most debt is found there, not in the design doc.

Plan for repayment

Strategic debt comes with a repayment plan. Know when you'll address it. Put it in the backlog. Allocate time for it. Don't let it become permanent.

I schedule "debt paydown" time in every sprint. Not a lot, maybe 10% of capacity. But consistently. Small, regular payments prevent debt from accumulating to unmanageable levels.

Code review is a cheap place to pay as you go. When a pull request touches a messy area, leave it slightly cleaner than you found it. No ticket, no meeting. Over a year, that adds up to more repayment than most dedicated cleanup weeks.

Talking about technical debt in interviews

Debt is one of the few topics that shows up in both system design and behavioral rounds, and the same habit helps in both: name the trade-off out loud.

In a system design round

Picture a candidate designing a chat service. They say, "I'll start with one relational database and one app server group. That's debt on purpose. It keeps the first version simple. When write volume passes what one primary can handle, I'd shard by user ID. I'd watch write latency to know when that day is near."

That one answer shows three things the interviewer wants: you know the shortcut, you know its limit, and you know the trigger. Compare it with a candidate who draws a sharded, multi-region design for ten thousand users. That's over-building, and it's debt of another kind, because every extra moving part must be run and understood. Evolutionary design covers how to describe a design that grows in stages, and anti-patterns to avoid lists the over-building traps. You can try this on a real prompt in practice system design.

In a behavioral round

The common prompt is "Tell me about a time you dealt with technical debt." A strong answer is short and has numbers. Say what the shortcut was and why it was reasonable at the time. Say how you measured the cost, such as hotfixes per release or days to onboard. Say what you repaid, what you left alone on purpose, and what changed.

Avoid the story where you wanted to rewrite everything and the team said no. Interviewers hear that often, and it signals that you see debt as a quality problem instead of a trade-off. Shape your story with the STAR method, and see preparing for behavioral interviews for how to pick stories that show judgment. The same judgment is what the engineering career growth patterns essay describes as the skill that compounds over a career.

Try this week

Open the code you touch most often and write three debt-log entries. For each one, record what was deferred, why, the cost you can see today, and the trigger that would make you repay it. Keep each entry to four lines.

Then pick one entry and say it out loud as an interview answer: "I took this shortcut because X. It costs us Y. I'd repay it when Z." If you can say that in thirty seconds, you understand the debt well enough to manage it.

Technical debt is a tool. Use it strategically. Manage it deliberately. Pay it down when it stops serving its purpose. The goal is not zero debt. The goal is productive leverage.

Think of debt as an investment. Some investments pay off. Some don't. The key is to know which is which, and to manage them accordingly.

Frequently asked questions

When should I take on technical debt?
When it buys something specific: a deadline, a cheap test of an idea, or a prototype you may throw away. Strategic debt is chosen with a plan to address it. The question is not "Should we have debt?" but "Is this debt serving a purpose?" Write down what you deferred and why.
When should I pay down technical debt?
When the feature is stable, the team is growing, or the interest is compounding: bugs are frequent, changes are risky, and velocity is slowing. Don't pay down while you're still exploring or when higher-priority work exists. Track the interest rate and repay when it starts to cost more than the work to fix it.
What's the difference between strategic and accidental debt?
Strategic debt is intentional: you know it exists and have a plan. Accidental debt is what you took on without knowing. It compounds silently. You manage the first kind. The second kind manages you. A debt log turns accidental debt into visible tasks.
How do I explain technical debt to a non-technical manager?
Use money. "This shortcut saved us two weeks. It now costs us about a day per release. In three months that's more than the fix would take." Pair one number with one decision you need from them. Avoid code detail and show the cost of waiting.
How should I talk about technical debt in a system design interview?
Name the shortcut when you take it. "I'll start with a single database and add read replicas when reads become the bottleneck." That shows you know the limit and the trigger. See evolutionary design for how to describe a design that grows in stages.
What is a good answer to "Tell me about technical debt you dealt with"?
Use a short STAR story: the situation, the shortcut and why it was reasonable, how you measured the cost, what you repaid, and what changed afterward. Interviewers listen for judgment and numbers, not for a story where you wanted to rewrite everything.
Is a full rewrite ever the right way to repay debt?
Rarely. Rewrites hide new debt and stop feature work for months. A safer path is to replace the system piece by piece, as the strangler pattern does, and to measure that each step makes changes easier.
How much time should a team spend on debt?
A steady slice beats a big cleanup. A common starting point is around 10% of each sprint. Raise it when your interest signals worsen and lower it when changes feel safe again. Treat the number as something you tune, not a rule.

About the author

Swati S. helps you master system design with patience. We believe in curiosity-led engineering, reflective writing, and designing systems that make future changes feel calm.

Ask about this page

No signup needed · Sign in to save your plan