• MrScottyTay@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    12 hours ago

    comment anything that needs extra info to explain what and why (if the code is not inherently self explainable)

    • spooky2092@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 hours ago

      And depending on your audience or how often you (don’t) go back and review it, it can help to comment the things that are self explanatory.

      I write a lot of scripts for my team and have to make them “maintainable” by the people in my department (who are as familiar with the concept, as your buddy that calls the gym the James), so I will regularly over comment so that any ape can come along and hopefully know what the script does.

    • ☆ Yσɠƚԋσʂ ☆@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      8 hours ago

      Works great in theory, but then people inevitably forget to update the comments and code gets out of sync with what the comment says. At which point you’re in even worse situation than not having any comments at all.