• curbstickle@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    0
    ·
    8 months ago

    As an extensive commenter, I completely agree.

    I need to know wtf I was doing, making it convoluted to save a few lines is pointless.

    • pcouy@lemmy.pierre-couy.frOP
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      8 months ago

      It’s often a good idea to make the code itself very explicit through verbose function and variable names, rather than writing comments that could lead to inconsistencies between code and comments (by not updating the comments at the same time as the code) (see Fallacious Comments and “What” Comments from the catalog)

      • curbstickle@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        “Some people do a bad job commenting and updating comments, so lets not do comments” is not an approach that works for me.

        Most of my code is at the prototype level. I’m concepting something out, usually paired with hardware.

        If someone can’t follow what I’m doing, its going to lead to problems. If a change happens to the hardware being controlled, code will not be good enough on its own.

        Rather than being accepting of bad commenting practice, make comments (and updating them properly) part of good practice. In my experience, It saves time in the long run and leads to better code at the end.