The Answer Was in the Code I Deleted

by•

I spent a day trying to fix something and could not. Nothing worked. I tried everything I could think of.

Then I remembered I had deleted a block of code months ago because I thought it was useless. It was not useless. It was doing something I did not understand, and I had removed it because it was old and messy.

I recovered it from version control in a minute and the bug was gone.

The lesson was not to stop deleting things. It was to understand what something does before I decide it does nothing. Messy code that is doing important work looks identical to messy code that is doing nothing, and I had never checked which was which.

Have you ever deleted something and instantly regretted it? And do you check why code exists before removing it now?

7 views

Add a comment

Replies

Be the first to reply

Have a question or a thought to share? Add a comment above to start the conversation.