• Another Catgirl@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      11
      ·
      2 days ago

      The comments are supposed to describe the mode of operation. For example "the volume up push button is an active low push button tied to the pin 10 interrupt handler. While the button is pressed and held down, the volume (internal variable) is increased in 2.5 dB increments until approaching the limit of 90 dB.

    • Xerxos@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      2 days ago

      Yes I had a coworker that commented like that:

      i++; // increase i by one

      Tells you nothing new - a wasted comment. Everyone who can program know this. A comment that describes what you do.

      i++; // increase i to move to the next entry

      A better comment, explaining why you do what you do. Always add information in your comments that the code doesn’t supply already. If you name your variables and methods well, good code is often self-explanatory. Use comments when it’s not.

      Of course in this trivial example no comment would be needed.

      Oh and use XML comments, when applicable.

  • eldain@feddit.nl
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 days ago

    I love that this is a photo of a print that has been places. Analog meme.