DEV Community

Pan Chasinga
Pan Chasinga

Posted on

2 1

Comment-out Syndrome

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?

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (2)

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.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️