Roger Ngo's Website

Personal thoughts about life and tech written down.

Don't Comment Out That Method, Just Get Rid of It!

In Clean Code, Uncle Bob mentions that if you’re making changes to a software system, and you're finding yourself commenting out things because "they might not be needed" anymore - just get rid of it!

That's what source control is for! If you make a mistake, or find out that you got rid of something that shouldn't have been removed, then just rollback! The key is to make incremental changes and and sync up often.

At work, I've recently had to do a rewrite for one of the modules for our enterprise health record and I found myself commenting out huge chunks of code during refactor. I realized what I was doing and decided to just delete those bits and guess what? Turns out I never had to "uncomment" them for that "just in case" moment!

Trust yourself and trust that source control! :)

(Well except when you're having an off day, or network access to your source control is down… :) )