• takeda@lemmy.world
    link
    fedilink
    arrow-up
    45
    arrow-down
    8
    ·
    10 months 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.

    • NuXCOM_90Percent@lemmy.zip
      link
      fedilink
      arrow-up
      30
      arrow-down
      3
      ·
      10 months ago

      Commenting is an art. Too much and it is outright misleading after the first hotfix. Too little and only the original developer can maintain it

      But uncommented code is a dick move. And, more importantly, it means you can’t punt bug fixes to the intern

    • suodrazah@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      10 months 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.

    • krellor@kbin.social
      link
      fedilink
      arrow-up
      10
      ·
      10 months ago

      When writing basic business code, structuring the code well and having good naming standards means you shouldn’t need a ton of comments, but you should still have some. Plus, using structured function content blocks gives you intellisense in some languages and IDEs, which is important for code reuse in teams.

      However, when I was doing scientific programming I’d have comments for almost every line at times where I put the mathematical formula and operations the line represents. Implementing a convolution neutral network with parameters to dynamically scale the layers or MPI stochastic simulations is much different than writing CRUD functions or basic business logic.

  • drolex@sopuli.xyz
    link
    fedilink
    arrow-up
    10
    ·
    10 months ago

    Wow this job has massive amounts of unnecessary stress, I wonder what the cause can be.

    The cause is me, 6 months ago.

    (Written for comedic purposes only. Managers are my single source of stress)

  • anti-idpol action@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    10 months 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
      ·
      10 months 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.

  • SpeakinTelnet@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    10 months 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.

    • towerful@programming.dev
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      10 months 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

  • stevecrox@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    Basic rule if someone claims X magically solves a problem they don’t follow X and are a huge generator of the problem.

    For example people who claim they don’t need to write comments because they write self documenting code are the people that use variable names x1,x2,y, etc…

    Similarly anyone you meet claiming Test Driven Development means they have better tests will write code with appalling code coverage and epically bad tests.

  • graycube@kbin.social
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    10 months ago

    I hate fixing other people’s code. It is one of the reasons I don’t like letting an AI write my code first draft either.