3 ms·
Well. There's two reasons to delete code. One is to delete code you think is unused or better rewritten. In this case you have unit tests and your source contro
by pilif 16y ago
Well. There's two reasons to delete code. One is to delete code you think is unused or better rewritten. In this case you have unit tests and your source control system that keeps the deleted lines forever and makes it more or less easy to get them back.
But if you want to delete code that's in use, that's different. You know: The code might be some rarely used feature, something added for one customers request or something that a lot of people once wanted but is now solved in a much better way but might still have some users.
In that case, removing the code certainly takes courage. Can you explain why the feature is gone? Can your users/customers live with the feature being gone (even though there might be a better replacement, they might be used to the old ways)?
Feature-creep is the most common case for unwanted code, bugs and maintainability issues.
It feels great though once you show the courage to remove the cruft and then you can look at lines over lines of red code (my diff highlights removed lines in red).
- hdragomir 16y agoI was talking deleting code that's about to be rewritten, or that just doesn't work, but this is a great twist! When taking out a feature, I don't think of it as code (unless a feature is dragging the app's performance to the ground). So I take it up with the person in charge (sometimes, that's me) and urge the approval of its removal. Taking care of users is the fun part -- because if people are furious about a missing feature, they're passionate about what you're building. Nothing compares to that, eh?