Deletin' Makes Me Feel Good

The following idea isn’t new. It’s been repeated many, many, many times, and that’s without digging through Twitter. It’s practically a truism.

Every line of code is a liability.

I learned from the excellent book The Goal that companies used to consider inventory as a positive item on a balance sheet, but that it is now considered negative because until sold, it is only capital loss. Inventory has non-zero cost and zero benefit.

The same is true of code. The primary stakeholder of any software project does not care in the least how much code was used to deliver the solution, or even whether code was used to deliver a solution. Only the benefit is valued; all else may be necessary costs to achieve the benefit, but they’re still costs.

I learned this lesson early in my career. Inheriting an old, decrepit application gave me plenty of opportunities to refactor and delete. It became a regular source of joy to delete lines, methods, files, and even whole projects from that application. I’d semi-seriously joke with my coworkers that I started every workday by deleting a few lines of code.

It also put me in the strange position of having removed more code than I had written. If we’re counting by lines, I added more value to the company by deleting code than by writing it.

By the way, the final link in the list above leads to a fairly old website/blog that’s nevertheless full of really insightful wisdom.