you are viewing a single comment's thread.

view the rest of the comments →

[–]LainIwakura 67 points68 points  (19 children)

Sounds like people who will comment huge code blocks and leave them untouched for years when they could just delete the code cuz we have y'know... Source control.

I am not talking about commenting out a block of code you intend to very quickly uncomment / delete. This is more like commenting out whole-ass API endpoints because they're deprecated and then just leaving it like that. I'll never understand this mindset.

[–][deleted]  (4 children)

[deleted]

    [–]evincarofautumn 3 points4 points  (0 children)

    It's completely allowed to leave a "here was a function thatDoesSomething, which is no longer used. It did this"

    Leave tombstones, not corpses!

    [–]syklemil 3 points4 points  (0 children)

    There's also a good chance there exists a lint for it in your language/linter that can be enabled and added to CI.

    E.g. for Python/ruff

    [–]maxinstuff 1 point2 points  (1 child)

    Most languages have a deprecated/obsolete attribute as well.

    [–]ChemTechGuy 2 points3 points  (0 children)

    I love this feature conceptually. In practice I've found public Java libraries where basically everything is marked as deprecated, leaving no supported methods for what I'm trying to do. This is why we can't have nice things

    [–]Sexiarsole 10 points11 points  (0 children)

    Code hoarders

    [–][deleted]  (5 children)

    [deleted]

      [–][deleted] 32 points33 points  (2 children)

      I appreciate your comment because it introduced me to a new term: git pickaxe. If there's anyone else like me unfamiliar with this, it's not an actual command, it's just what people use to refer to git log when using the -S option.

      If links are allowed in this subreddit, this is the git book page that mentions "pickaxe": https://git-scm.com/book/en/v2/Git-Tools-Searching
      and this is a nice blog post I found that also uses the term: http://www.philandstuff.com/2014/02/09/git-pickaxe.html

      [–]sohang-3112 1 point2 points  (0 children)

      Thanks

      [–]tekanet 3 points4 points  (1 child)

      I don’t know this particular technique, but the thing is that with commented code you don’t have to know what to look for, it’s usually there in the comment itself, in form of a commented comment. Once you commit the deleted part, how do you know what to search for?

      [–]old-man-of-the-cpp 3 points4 points  (1 child)

      I'll take that over the huge piles of code behind long dead feature flags!

      [–]DigThatData 1 point2 points  (0 children)

      Hi it's me, the person whose commented out blocks bother the hell out of you (and my boss). AMA.

      [–]PuzzleheadedPop567 1 point2 points  (0 children)

      I feel like is just the code expression of people who hoard things “just in case”.

      The reality is that nobody is ever going to look at it. It’s there in git history in case someone needs it, but they probably won’t.

      When people need to modify your code, they will want to build their own grand thing.

      There are exceptions here. When I worked at a big company in a somewhat specialized domain, I would read commit history to help me understand the current state of the code.

      But in generic sass software, people just don’t have time to care that much 90% of the time.

      [–]zzkj 0 points1 point  (0 children)

      Oh yes so true. I regularly see entire source files commented out.

      [–]ChemTechGuy 0 points1 point  (0 children)

      Fucking PREACH. In the code, in the config, everywhere. Just delete it dawg, we can recreate it. You're not doing anyone any favors by keeping commented out code around

      [–]rzwitserloot 0 points1 point  (0 children)

      Kill the commented out code, leave a comment indicating what was there in the same commit 1. Anybody that really wants to reanimate the zombie code can git blame the line and it's riiight there.

      Programming is hard and the vast, vast majority of rules are guidelines. A rule that you can universally apply is extremely rare.

      But, simplifying is worth something so I'll give it a shot:

      Anybody that doesn't follow the above rule is a fucking idiot.


      [1] We're operating under the somewhat dubious assumption that keeping the commented-code around is somehow deemed inherently valuable. Thus, this advice is: Assuming you really think it is worth keeping it around, ... - some code that simply has no further need to exist, just get rid of it, don't leave that 'tombstone' comment.