top | item 33032018

Ask HN: Is Code Deletion Helpful?

3 points| vedant_ag | 3 years ago

There is a lot of online literature about the benefits of deleting stale/unreachable code.

But in practice, do teams actually do this regularly? More importantly, does your manager recognise this as "work"?

Or does it mean: code deletion is good when other people so that I don't have to but I don't invest my time into it? Like technical documentation.

6 comments

order
[+] john_the_writer|3 years ago|reply
It's 100% a good thing..

Most places I've worked (> 20 years) regularly delete dead code. Not all the time, but often enough that it's not a problem.

Tech docs on the other hand seem to still kick around. Mostly I read the Tests these days. This tells me the why, and how better than any doc I've ever seen. And they're up to date.

[+] john_the_writer|3 years ago|reply
I should add, it's not typically done (from my exp) as a bespoke task. Sometimes "delete this endpoint" but often it's just a matter of refactoring.
[+] moasda|3 years ago|reply
I've had a lot of discussions with developers on this topic. It seems to be difficult for developers to delete code even if it is versioned in Git, so the code is not really lost.

I regularly encourage my teams to delete code that has no use in the near future. Because every line of code in the production environment leads to maintenance effort, so this would save their time.

[+] vedant_ag|3 years ago|reply
How often (say what % of PRs) do teams end up doing it?
[+] muzani|3 years ago|reply
It's definitely a good thing. I categorize it under documenting. But while it costs time to read documentation and comments, it saves time on reading code that isn't stale. If you don't do it regularly, Chesterton's fence becomes crippling.