4.5.20 · HinglishSoftware Engineering

Technical debt — types, managing

1,912 words9 min readRead in English

4.5.20 · Coding › Software Engineering


Technical debt KYON hai?

Key distinction: debt aur bug ek jaisi cheez NAHI hai. Bug = galat behaviour. Debt = aisa code jo kaam karta hai lekin change karna, samajhna, ya extend karna mushkil hai.


YE accumulate KYUN hota hai (first-principles reasoning)

Software mein ek quantity hoti hai jise understandability/changeability kehte hain. Har shortcut use kam karta hai. Maano:

  • = future change ki cost,
  • = cost agar code clean hota,
  • = interest rate per change (mess ki wajah se fractional slowdown),
  • = un future changes ki sankhya jo us code ko touch karengi.

Toh shortcut ki wajah se jo total extra cost pay hoti hai woh accumulated interest hai:

Figure — Technical debt — types, managing

Technical debt ke TYPES (Fowler's Quadrant)

Martin Fowler debt ko do axes pe classify karta hai: kya yeh deliberate tha ya inadvertent, aur reckless tha ya prudent?

Reckless Prudent
Deliberate "Hamare paas design ke liye time nahi hai." "Hume abhi ship karna hai aur consequences deal karne honge (aur hum jaante hain woh kya hain)."
Inadvertent "Layering kya hoti hai?" (pata hi nahi tha) "Ab hume pata hai ki hume kaise karna chahiye tha."

Common practical categories:

  • Code debt — duplication, dead code, bura naming, koi tests nahi.
  • Design/architecture debt — galat abstractions, tight coupling, layering violations.
  • Test debt — missing/flaky tests ⇒ code change karne ka darr.
  • Documentation debt — purane ya missing docs.
  • Dependency debt — outdated libraries, unpatched versions ("software rot").
  • Infrastructure/build debt — slow CI, manual deploys.

Isse KAISE manage karein

Workflow:

  1. Visible banao — ek debt register/backlog rakho, // TODO/FIXME tags lagao, static analysis use karo (SonarQube), ek debt ratio track karo = remediation cost / development cost.
  2. Quantify karo — principal aur interest estimate karo (upar wale formula se) items rank karne ke liye.
  3. Prioritise karo — us code mein debt pehle fix karo jise tum aksar change karte ho (high ). Cold code ko chhod do.
  4. Pay down karo — strategies:
    • Boy Scout Rule: "code ko waisa chhodo jaise paya tha usse zyada clean" (continuous choti choti repayment).
    • Dedicated %: har sprint ka e.g. 20% refactoring ke liye reserve karo.
    • Refactor-before-feature: jis area ko extend karne wale ho, pehle usse clean karo.
  5. Prevent karo — code review, definition-of-done, automated tests, linters.

Common mistakes (Steel-man + fix)


Recall Feynman: ek 12-saal ke bachche ko samjhao

Apna kamra imagine karo. Tum jaldi mein ho toh saari cheezein bed ke neeche dha dete ho rakhne ki jagah. Ab kamra theek lagta hai aur tum jaldi finish ho gaye — yeh shortcut hai. Lekin har baar jab moze chahiye, poore dher mein khodna padta hai (yeh interest hai — har baar extra effort). Agar roz moze chahiye, toh abhi theek se safai karna worth it hai (yeh principal pay karna hai). Agar kal ghar badal rahe ho aur sab phenk doge, toh dher aise hi chhod do! Acche programmers apna kamra perfect nahi rakhte — woh jo cheez zyada use hoti hai use tidy rakhte hain, aur baaki chhod dete hain.


Flashcards

Technical debt ke do financial parts kya hain?
Principal (shortcut fix karne ki cost) aur Interest (unfixed code pe kaam karte waqt har baar recurring extra effort).
"Technical debt" metaphor kisne coin kiya?
Ward Cunningham (1992).
Debt repay karne ka rule of thumb kya hai?
Repay karo jab — yani one-time fix cost future interest ( changes × clean cost × interest rate) se kam ho.
Kya technical debt aur bug ek hi cheez hai?
Nahi. Bug = galat behaviour. Debt = aisa working code jo change/samajhna/extend karna costly ho.
Fowler's technical-debt quadrant ke do axes kya hain?
Deliberate vs Inadvertent, aur Reckless vs Prudent.
Kaunsa quadrant "healthy" debt hai?
Deliberate + Prudent (ek conscious, tracked, planned loan).
Boy Scout Rule kya hai?
"Code ko hamesha waisa chhodo jaise paya tha usse zyada clean" — debt ki continuous choti choti repayment.
Technical debt ke char types batao.
Code, design/architecture, test, documentation (aur dependency, infrastructure bhi).
"Saari debt eliminate karo" kyun galat hai?
Refactoring mein principal + opportunity cost lagti hai; rarely-touched code ke liye fix cost interest saved se zyada hoti hai, isliye kuch debt optimal hoti hai.
Static analysis mein debt ka size kaunsa metric measure karta hai?
Debt ratio = remediation cost / development cost.
Debt ignore karne se "debt spiral" kyun hoti hai?
Interest future kaam ko slow karta hai, jisse repay karne ka time aur kam milta hai, toh debt aur slowdown dono compound hote rehte hain.

Connections

  • Refactoring — principal pay down karne ka primary tool.
  • Code Smells — observable symptoms jo debt signal karte hain.
  • Unit Testing / Test Driven Development — test debt kam karta hai aur refactoring ko safe banata hai.
  • Software Maintainability — debt ek maintainability cost hai.
  • Agile Sprint Planning — yahan tum repayment ke liye % capacity reserve karte ho.
  • Coupling and Cohesion — high coupling design debt ka ek major source hai.
  • Continuous Integration — infrastructure debt yahan rehti hai.

Concept Map

creates

has

has

accumulates as

compared against

not the same as

classified by

good debt

trouble

shows up as

Technical debt

Shortcut now

Principal fix cost

Interest recurring effort

Bug wrong behaviour

Fowler Quadrant

Deliberate + Prudent

Reckless / Inadvertent

Repay when P < n C0 i

Code & Design debt