Skip to content
Discussion options

You must be logged in to vote

Deleting code becomes the better option when the cost of understanding it exceeds the cost of replacing it.

Some signals I look for:

The code has little or no test coverage and adding tests is harder than rewriting the logic.

The original assumptions no longer match current requirements.

Small changes consistently introduce regressions.

In those cases, incremental refactoring tends to preserve accidental complexity. A focused rewrite, scoped tightly and protected by new tests, often results in simpler and more reliable code.

The key is keeping the rewrite constrained rewriting everything at once usually recreates the same problems in a different form.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by iaversao7-sketch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants