Alpha Coder

Dealing with code debt

Code debt (or technical debt) is the amount of extra work that needs to be done due to choosing the easy way now instead of a better way that would take more time to complete. It’s human developer nature to always follow the path of least resistance e.g write spagetti code or fail to think things through before coding. As such dealing with code debt must be given priority by individuals and teams that want to build good software in a cost and time effective manner.

Code debt is not necessarily a bad thing though. As bestselling Rich Dad, Poor Dad author Robert Kiyosaki says, “good debt makes you rich and bad debt makes you poor”. It must however be kept at a minimum at all times. This can be achieved by avoiding debt as much as is within one’s power and spending a good chunck of dev time paying off the debts already owed. A wise man once said “a good developer always pays their code debts”.

When could we incur code debt i.e “good” debt? Writing elegant and future-proof code is not always possible as one may have limited time and/or experience in a given domain. For instance, it is not uncommon to find a lot of code debt in fast-paced environments like at startups trying to ship an MVP or find product-market fit. However, if the debts are not paid soon afterwards, a lot of damage can happen in future.

Outlined below are some steps to take in dealing with code debt.

Any reasonably complex codebase has some debt. Even simple ones do. The goal is to reduce this debt as much as possible and keep it that way as more code is added. This must be done proactively or else debt would compound to the point where continued development isn’t feasible any longer. At this point, a rewrite may be the only logical solution. This can hurt a business and its development team badly.

Subscribe to my newsletter for updates on new articles, courses and more. Enjoy the content on Alpha Coder? Please buy me a coffee.

comments powered by Disqus