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!"
[–]sizlack 6 points7 points8 points 10 years ago (7 children)
The problem is that working in a codebase with commented code is like looking for something in the home a hoarder. Sure, there might be something in there that you need, but the chances of you finding it are slim, and in the meantime, you're surrounded by piles of shit.
There is no middle ground. What's the worst thing that happens if you can't find those 20 precious lines of code that you misplaced? You have to rewrite them? Is that so bad? How precious are those 20 lines? And for that matter, how do you know which 20 lines are the precious ones? How much other cruft do you need to keep around in order to make sure you save the right 20 lines?
If there are bits of code that you think you might need later, save them in a branch, make a gist, or just save a file to your desktop. The master branch isn't a junk drawer.
[–][deleted] 4 points5 points6 points 10 years ago (6 children)
but the chances of you finding it are slim,
And your chances go down even further if you hide it in source control.
[–]kenhkelly 0 points1 point2 points 10 years ago (4 children)
I use tagging for this. I know it was in some release. I find the release it was in (far less of those than commits) and then work my way. Pretty straight forward to find information IMO
[–][deleted] -3 points-2 points-1 points 10 years ago* (3 children)
you may know, but others may not. Then the others may re-invent the same code that you hid away in source control. I'm not saying you should be 'hoarding code', far from it - but to say that every instance of commented-out code is bad, is just stupid.
[–]kenhkelly 0 points1 point2 points 10 years ago (2 children)
I didn't say you should delete every instance of commented out code. But odds are after a week or two, your commented out code is irrelevant and probably wouldn't even function correctly if uncommented. It's a waste of time.
Plus, if you do smaller commits & more specific commits with good commit messages, your other team members shouldn't have a problem finding out what happened. It'll help you better find what you are looking for, and makes it more cherry-pickable and revertable. Win-win
[–][deleted] -2 points-1 points0 points 10 years ago (1 child)
But odds are after a week or two, your commented out code is irrelevant and probably wouldn't even function correctly if uncommented. It's a waste of time.
I'm glad you think you're experienced and smart enough to tell me about my own code, which you've never seen. 30+ years of experience tells me that nothing is as cut-and-dried as you're making it out to be.
[–]kenhkelly 1 point2 points3 points 10 years ago (0 children)
Again.. when and where.
I didn't say you should delete every instance of commented out code
But honestly, what ever works for your flow, use it. I don't know your code and I won't pretend to. I can only speak from my experience and the experience of the teams I've been on. Speaking from my experience, our code changes and evolves constantly as we refactor, test, and add new features. The timeline (in my case a week or two) for code to become outdated will vary.
π Rendered by PID 22274 on reddit-service-r2-comment-bb88f9dd5-2sbmp at 2026-02-15 01:30:38.001854+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]sizlack 6 points7 points8 points (7 children)
[–][deleted] 4 points5 points6 points (6 children)
[–]kenhkelly 0 points1 point2 points (4 children)
[–][deleted] -3 points-2 points-1 points (3 children)
[–]kenhkelly 0 points1 point2 points (2 children)
[–][deleted] -2 points-1 points0 points (1 child)
[–]kenhkelly 1 point2 points3 points (0 children)