• Maalus@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        11 months ago

        Comment only in extraordinary situations, when something you read can confuse someone. And by that I mean the business logic, not that you used a method that’s confusing to people since they only know the basics of the language.

        • Sylvartas@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          11 months ago

          Honestly, after a few years of working with juniors (and being one myself before that), I have to disagree with the last part. Sure, it’s fine for solo projects but people’s programming skills can vary heavily. I know people who will pull the wildest C++ compile time tricks you’ve ever seen, but a pointer to a pointer would somehow break their brain.

      • stebo02@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        I usually comment on whole groups of lines of code, so the goal of each part of the code is clear

    • RagingRobot@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      11 months ago

      I would disagree. I love to use comments to format my code and separate the sections. I think it’s so beautiful. Also I love when libraries have ASCII art in the comments at the top of the main file lol. It makes the code more fun in my opinion.

      I went to college with a guy who would treat the code as art when presenting projects. His code was always beautiful. Not super functional but always beautiful. It always stuck with me. I want my code to always be functional and beautiful. Easy to read and a pleasure to work with. That’s my goal at least. Comments help with that.

      Also it depends on what the code is for haha