• takeda@lemmy.world
    link
    fedilink
    arrow-up
    42
    arrow-down
    5
    ·
    2 years ago

    I’m Bill I don’t comment my code (except complex parts), instead I try to make code clear, including using proper variable and function names and try to keep functions short. I don’t think I ever got lost in my own code in my 20+ years of experience. Even got complements about it.

    The programming language is meant for humans to read/write, if you need to put comments to understand your code then your code sucks.

    • suodrazah@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      2 years ago

      Use comments to describe the philisophy of the code, the why. And any non obvious extended relationships. Risk. Etc.

      Comments on function are typically a waste of space.

    • towerful@programming.dev
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      2 years ago

      Classic comments.

      Code is spaghetti.
      Comments describe what it used to do.
      Comments are no longer relevant.

      Comments should be about how/what a code block does something.
      Not what a line of code does

  • SpeakinTelnet@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    2 years ago

    I don’t care how much you think your code is readable, plain text comments are readable by everyone no matter the proficiency in the programming language used. That alone can make a huge difference when you’re just trying to understand how someone handled a situation.

    • lorty@lemmygrad.ml
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      2 years ago

      Then someone needs to change something about the code and doesn’t bother updating the comment. Now you still have uncommented code but with a comment that confuses instead of helping.

      • SpeakinTelnet@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        2 years ago

        IMHO the issue in this situation is not the comment but that the person updating the code didn’t do his job properly which shouldn’t be an excuse not to do it from the start.

  • anti-idpol action@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

    This is Bill.

    Bill doesn’t need to minify his code, he names things using a single character even in compiled languages.

    Bill is a heckin chad who can guess what the code does merely by looking at types and control flow.

    Be like Bill

    • ChickenLadyLovesLife@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      I started coding with TurboBasic. My favorite thing about TB was that you could have variable names of any length but the compiler only used the first two letters - and case insensitive at that. So “Douchebag” and “doorknocker” looked like different variables but were actually the same thing.