+ 48
Commenting out unneeded code instead of deleting, good or bad? Have your say.
Friends just wondering it's bad practice or not.
28 ответов
+ 20
Clean code principle YAGNI (you ain't gonna need it) on my side... Sometimes I keep backups.
+ 39
@Dayve still have three exam remaining will surely use more after that (7days more).
And that was the beta version of likes, will release stable version later.
+ 18
deleting unnecessary code is better for me.
+ 17
There goes commenting! Most of the people delete the unneeded code...let's comment out those parts. Creating instances with errors would help us in abstracting our mind! Commenting's the best!
BTW Welcome back @Ram and thanks for that WelcomeBackLikeStorm!😊😄
+ 15
I always have the option to undo my deletions, but I guess commenting them out would be better for large projects.
+ 14
i usually comment what's unneeded
and later on when i determined i really don't need it it's bye bye birdie
+ 14
@Ram 😂 I'm desperate to see the stable version!
+ 12
I left some initial ideas on the labyrinth solver in my labyrinth generator 2 for later, when I have some more time :)
I wondered if I should delete it, but this way I kind of feel obliged to finish the unfinished, some day... ;)
+ 12
as long as I've been Programming, I've been taught that it's bad programming to comment it out what you aren't going to reuse or something that you're not going to use at all. It makes for unclean code and it should be avoided. However, that doesn't mean you shouldn't do it entirely, there a cases where you should do it (usually for testing purposes) just make sure you keep it under control and don't let the commenting get out of hand.
+ 11
i do that when im not sure if i will need to use that code sometime later, but definitely delete the commented code when your project is complete
+ 8
Everybody should use a version control system which makes "commenting out" unnecessary. So that is a bad practice.
+ 7
I usually keep it for sometime as every commented code of mine is something that i might be needing in future or was a previous logic which can be switched from commented to non-commented anytime.
+ 6
When I decide to clean my code, it means that the time for unnecessary stuff has come...
+ 6
I like closure so aim to remove commented out code within at the very most a week. it isn't ideal world so doesn't always happen but I'd rather leave comments than replace stable code with untested.
+ 6
I don't think it's a bad practice. We can use that somewhere else to save time in some cases.
+ 5
I prefer commenting unneeded code with appropriate comment rather than deleting it. You never know you might require similar code later.
And most importantly why to waste your own work, you might get chance to improve the same in following days.
+ 5
I comment out unneeded code while testing, but delete it if it has no reason to be in the program.
+ 4
depends on how unneeded the code is.
if (it's a code that is usefull){
I might make a little note beside it and leave it there;
}
else{
it's delete;
}
+ 4
Deleting unnecessary code instead of commenting is better for me. because comments are also make code file lengthy this cause performance issue. its also takes more compilation/ interpretation time.
+ 4
Personally speaking, I don't delete code very often. I develop day in and day out (several c+/c# applications), to me deleting code you don't need or use can be wasteful, there have been many times where I've written code that's become useless as I advance further into a project, I much prefer to comment stuff out. As the, now commented code, can be used elsewhere in the program or even elsewhere in other projects, especially if it's nice, clean and efficient code, it can save you hours of writing