Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When I comment out code, I add a timestamp of when I disabled it. Then, when I come across commented code with a timestamp more than 6 months old, I go ahead and delete it. Best of both worlds!


This is a similar to an idea that David Schnepper talked about at Velocity Ignite this year.

It's only a five minute presentation but it blew me away and I'm keen to give it a try for real at some point. Video here:

https://www.youtube.com/watch?v=29UXzfQWOhQ


I like this alot, would anyone be keen to collaborate on a simple ruby gem to implement this 'tombstone' method?


great idea, I would definitely throw it into all of my ongoing projects.


I put this together today, would value any feedback and/or contributions:

https://github.com/lewispb/tombstone


This is thought provoking; I shared my reactions here: http://djwonk.tumblr.com/post/101423057084/tombstones-as-a-w...


Wow, simple and short, but has already given me a ton of ideas. Saved and shared with our IS department too.


I wonder how they tombstone CSS.


Funny how this is kinda Halloween-ish.

Great share, thank you!


Oh lord.

Best demonstration of Poe's Law right here.


Doesn't "git blame" take care of your timestamps for you?


no. vc will only take care if you have the history and know what you are looking. if you publish a final version only like this all that is lost. if you run a interpreted language you can't find the place of the old code while debugging at runtime.

there are many reasons to leave code comments besides neglect. though in this case it's neglect :)


You still can put one on top of that, like this:

    #if 20141031     // Date as a valid number != 0
      // Active code
    #else
      // Inactive code
    #endif
Helps documenting experimental alternatives, even without SCM.


This is really terrible practice. You should only do this if you really have no SCM available.


I'm talking about experimental alternatives. This is not for production code. And it's still better than just out-commenting code to deactivate it.


Glad to hear this isn't an odd concept. When I see others have commented out code in our codebase, I do a quick git blame (Sublime Git ftw!) and if it's from the previous year I'll just delete it.


I would be awesome if there were a plugin (for your favorite text editor) for that. It should be easy to add automatically and remove when you uncomment it.


Perhaps not a bad idea. One advantage to David Schnepper's suggestion (in the video above) is that the tombstone is executable code, which can lead to metrics and even automated code removal. Buyer beware!


I like that idea. I remove commented code when it's "old enough" but know how long it's actually been could be really helpful.


Hmm what a nice extension idea for emacs comment-dwim.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: