+ 48

Commenting out unneeded code instead of deleting, good or bad? Have your say.

Friends just wondering it's bad practice or not.

11th Apr 2017, 4:46 PM
Ram chandra Giri
Ram chandra Giri - avatar
28 Answers
+ 20
Clean code principle YAGNI (you ain't gonna need it) on my side... Sometimes I keep backups.
11th Apr 2017, 7:42 PM
Tashi N
Tashi N - avatar
+ 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.
12th Apr 2017, 1:02 PM
Ram chandra Giri
Ram chandra Giri - avatar
+ 18
deleting unnecessary code is better for me.
12th Apr 2017, 2:51 AM
Agus Mei
Agus Mei - avatar
+ 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!😊😄
11th Apr 2017, 4:58 PM
Dev
Dev - avatar
+ 15
I always have the option to undo my deletions, but I guess commenting them out would be better for large projects.
11th Apr 2017, 4:53 PM
Hatsy Rei
Hatsy Rei - avatar
+ 14
i usually comment what's unneeded and later on when i determined i really don't need it it's bye bye birdie
11th Apr 2017, 4:49 PM
Burey
Burey - avatar
+ 14
@Ram 😂 I'm desperate to see the stable version!
12th Apr 2017, 2:37 PM
Dev
Dev - avatar
+ 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... ;)
11th Apr 2017, 5:22 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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.
11th Apr 2017, 8:00 PM
SoraKatadzuma
SoraKatadzuma - avatar
+ 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
11th Apr 2017, 4:49 PM
Edward
+ 8
Everybody should use a version control system which makes "commenting out" unnecessary. So that is a bad practice.
14th Apr 2017, 3:58 PM
Tamás Barta
Tamás Barta - avatar
+ 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.
11th Apr 2017, 5:38 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 6
When I decide to clean my code, it means that the time for unnecessary stuff has come...
11th Apr 2017, 7:35 PM
seamiki
seamiki - avatar
+ 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.
11th Apr 2017, 11:15 PM
Leon
Leon - avatar
+ 6
I don't think it's a bad practice. We can use that somewhere else to save time in some cases.
12th Apr 2017, 5:10 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 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.
11th Apr 2017, 7:27 PM
Harshal
Harshal - avatar
+ 5
I comment out unneeded code while testing, but delete it if it has no reason to be in the program.
12th Apr 2017, 1:42 PM
Seth De Puy
Seth De Puy - avatar
+ 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; }
12th Apr 2017, 2:56 AM
Maduekwe Ebuka Collins
Maduekwe Ebuka Collins - avatar
+ 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.
12th Apr 2017, 2:01 PM
Bheemsen Singh
Bheemsen Singh - avatar
+ 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
12th Apr 2017, 3:47 PM
Will Spektre
Will Spektre - avatar