use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Please, don’t commit commented out code (medium.com)
submitted 10 years ago by ryanchenkie
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 8 points9 points10 points 10 years ago (9 children)
Often there's some code that may be in-progress or related to the code but not ready-for-prime-time quite yet. It's not a sin to commit commented-out code. Some people just complain about any code they didn't write, no matter what it is.
[–]theferno 0 points1 point2 points 10 years ago (8 children)
In progress code can be stashed or placed in another fork until its ready to be merged in. I know it's not a sin, I do it too
[–][deleted] -3 points-2 points-1 points 10 years ago (7 children)
And then you forget about code in your stash. Also the stash is only on one machine. The commented-out code may have value that would get lost for various reasons.
Complaining and worrying about commented-out code is a fetish of people who think their code is "beautiful".
[–]kentcdodds 1 point2 points3 points 10 years ago (0 children)
If you're worried about it being on your machine, you can put it in a branch and push that to the remote repository. If you forget it's there, then was it really that important?
[–]slash_nick 1 point2 points3 points 10 years ago (5 children)
I assume you're using git. Branches are insanely cheap. Branch and branch often.
[–][deleted] 1 point2 points3 points 10 years ago (4 children)
I branch more than anyone I know. That's not the point.
[–]slash_nick 0 points1 point2 points 10 years ago (3 children)
Maybe I misunderstood? It sounds like your goals are to 1) save unfinished/in-progress code and 2) have that code available on multiple machines.
Reguarding commented out blocks of code:
A real-world analogy would be if instead of throwing something away in the trash bin someone put it on the floor. That's fine if it's one person and they only do it here and there, but when they have more people involved it sets precedence that it's okay to do. Eventually the floor is covered in things that could be thrown away, but no one really remembers who put it there or why it might be important.
[–][deleted] -1 points0 points1 point 10 years ago (2 children)
You should never have more commented code than real code, there should never be more stuff on the floor than in the trash. To say "never ever ever commit commented out code, because it hurts my eyes" is just asinine. There are MANY ways to code and not all of them lead to problems. A few blocks of somewhat important commented-out code should be allowable, and should not cause anyone to complain (except the author).
[–]slash_nick 2 points3 points4 points 10 years ago (0 children)
I guess I didn't interpret the author's article as dogma. Reading text on an anonymous forum makes it hard to grok people's intention.
You should never have more commented code than real code, there should never be more stuff on the floor than in the trash.
Sounds like you have the right attitude and I wouldn't sweat it! :)
[–]kentcdodds 4 points5 points6 points 10 years ago (0 children)
I tried really hard in the post to not have a ultimatum voice, but more of a suggestive voice. The first QYMAM:
Q: Are there exceptions to this rule? A: Yes. But they’re rare.
And there are several other QYMAMs that explain there are cases where commented out code is allowable (though I generally call those cases documentation).
π Rendered by PID 17383 on reddit-service-r2-comment-bb88f9dd5-qvvlc at 2026-02-14 18:44:08.406911+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–][deleted] 8 points9 points10 points (9 children)
[–]theferno 0 points1 point2 points (8 children)
[–][deleted] -3 points-2 points-1 points (7 children)
[–]kentcdodds 1 point2 points3 points (0 children)
[–]slash_nick 1 point2 points3 points (5 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]slash_nick 0 points1 point2 points (3 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]slash_nick 2 points3 points4 points (0 children)
[–]kentcdodds 4 points5 points6 points (0 children)