5
jkuhl
356d

I want to slap the previous devs on my team. Not the current ones, the previous once.

I don't need a comment on every. single. line. of. code

//verify thingies
if(thingies != null && thingies.count != 0) {

Like my god, i can read the if statement to know what it's doing, goddamn.

Comments should only be used when doing something that might not be immediately obvious to the next dev looking at the code.

Comments
  • 0
    I mean if you want to remove comments it’s a simple find and replace with regex probably
  • 0
    @supernova777 I agree - at least they give some sort of effort to make it readable
  • 0
    Chance is the current des just state it were the previous ones, but in fact it was them.
  • 1
    @supernova777 @shovethisrant when they are all over the place it really does harm. It's like trying to do a sudoku with a toddler giving you a constant stream of helpful things like "that's a seven, I like sevens, whooo line line line, you can draw a duck with seven" mixed in with complete nonsense like toddlers do. Because you know what, who the fuck is going to maintain all these comments when the code changes?

    No comments are bad. You want some documentation of the API and self documenting code is a myth. Over doing it can be just as bad.
  • 0
    @hjk101 I really think that mentality is over dramatic and elitist. Just delete the comment if you don’t like it lol. It’s not that hard
  • 0
    Comments are only good when they are maintained.

    Unmaintaned comments are usually the source for "i stepped on a claymore and I'm not feeling well" debugging.

    Thus: Only comment if necessary. Redundant comments are just additional maintenance work.
  • 0
    I kind of agree, but rather think that the code should be as self-documenting as possible. Wherever you might feel the need to write a comment... Chances are you can abstract that block of code into a method with that comment as its name.

    In this case it's a bit of an extreme example, but I'd either abstract the whole block of code into a method like Validate(thingies); or at least abstract the condition in the if-statement to something like AreValid(thingies) or CanValidate(thingies).
  • 0
    I also realised with the last part of my previous post that even with the code comment it's less clear what is happening than if the code was written the way I described - right now I can't tell whether the comment is saying that the condition in the if-statement is validating thingies, or if the code block following the condition is what performs the validation. It's probably the latter, but could go either way imo 🤷🏻‍♂️
Add Comment