• philm@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    11 months ago

    Yeah, but unironic…

    If your code needs comments, it’s either because it’s unnecessarily complex/convoluted, or because there’s more thought in it (e.g. complex mathematic operations, or edge-cases etc.). Comments just often don’t age well IME, and when people are “forced” to read the (hopefully readable) code, they will more likely understand what is really happening, and the relevant design decisions.

    Good video I really recommend: https://www.youtube.com/watch?v=Bf7vDBBOBUA

    • astraeus@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      11 months ago

      This mindset is good, but unfortunately enforces bad programmers to leave their undocumented code in critical places where someone eventually has to figure out what the hell they were doing or refactor the whole damn thing because they got promoted to middle-management and can’t remember why they even wrote it.

    • Pickle_Jr@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      0
      ·
      11 months ago

      Yeah, another way I’ve heard it phrased is comments are for explaining why you did things a certain way, not for explaining what it’s doing.