Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera115857y@filthyranter I sometimes commit commented code if its code to be, where the dependencies are not in place.
Writing a stub, commenting it out and adding a todo line so it shows up in the todo list is a good way to quickly finish up once all else is done. -
ripbit3767y@Olverine @filthyranter Of course. I should've made it clear.
I was carefully doing the Ctrl-Z Ctrl-Y surgery to get back the code I deleted prematurely. The dev saw me doing this a couple of times and decided to drop those words of wisdom that would guide me to this day. -
Why oh why?
Use local history of your IDE. Use version control. Never let commented code stick around.
I consider this an anti-pattern. -
This is exactly why our codebase is littered with commented out code.
My colleagues adhere to your advice, but then always forget to delete it before committing... -
Never delete C code. comment it out, but prefix it with a newline trigraph so that it looks like a comment but still executes.
-
No worries when using Android Studio since it has local history. Xcode sucks it doesn't have that feat π
-
When I'm about to rewrite some code, I always comment out the old code first, sometime i can reuse some of the old code.
-
Make sure you don't commit commented out code, one of our projects is full of commented out code and nobody dares to remove them (because they *might* be "important")
-
@Voxera Of course, if it's an actual thing that will be used later on. But if it's just past used code, it has nothing to do in the current codebase, y'know
-
Voxera115856y@filthyranter and thats where source controll like git is the way to go.
Especially since commented code might not light up as removed in a diff, at least not at clear.
So every “rule” has its exception :)
Related Rants
-
CowboyBebop16"Don't give your 100%. Never. Once you gave, managers will start expecting more than that." - My mentor.
-
linuswillner15(Q: How much are you allowed to Google as a developer?) βYouβre allowed to Google as much as you want. Th...
-
CozyPlanes13A ten minute task can be finished in a minute when you think in the toilet. Proven by experience
Never delete code immediately. Always comment it out first.
rant
wk103