DEV Community

loading...

Comment-out Syndrome

pieohpah profile image Joe Chasinga ・1 min read

Alt Text

"I'm just going to keep this around just in case." I thought, commenting out that block of code before heading to experiment on another thing. Due to my adventurousness, one block comment became two, three, and so on day-on-day. After a while, they started to creep in and became too distracting!

It's way to easy for me to comment out code I ain't sure about when I'd like to experiment something, event though I could always fork a branch. It's way easier to come back to where the comments are that to git checkout or git stash! This is especially really easy when I'm not in a team where code review is a ritual.

When I build something, there's always a conflict at every step of the way between making it "right" or moving fast. A balance seems like a faraway Utopian dream because that would take even more thought and time than just falling on either side.

At my worst, my code can be up to 40% comments! It's downright ugly but thinking too much about what to do can really break the train of thoughts or the fun when I'm on fire!

What are your ways of coping with this comment-out syndrome?

Discussion

pic
Editor guide
Collapse
pbouillon profile image
Pierre Bouillon

What are your ways of coping with this comment-out syndrome?

I'm just making small features one by one, and committing each one of them after completion
This way, I can just look at older commits whenever a part of my code changes in my file

To ease this process, check out diff so fancy !

Collapse
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

Branching and atomic commits! But I also comment out code occasionally; nothing wrong with that.