• brokenlcd@feddit.it
    link
    fedilink
    arrow-up
    71
    ·
    8 days ago

    Tbf, i always comment my code to do a sanity check of what i am doing along the way( think rubber duck method with comments). The problem is that my writing is so cryptic i am the only one that could ever understand it.

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

      I have to comment my code because otherwise I have no idea wth I was writing 6mo ago.

      Like, I recently had to update a script I wrote 2 years ago and had thought 'this is self explanatory, I don’t need to comment it’s only to have me come back and have to walk the code to figure out I forgot to include an edge case that hadn’t occurred yet …

      • Omgpwnies@lemmy.world
        link
        fedilink
        English
        arrow-up
        11
        ·
        8 days ago

        Break it up into functions with names that describe what it does, then the script becomes basically a sequence of function calls and is easier to read and troubleshoot.

        • jkercher@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          7 days ago

          I’m on your side dude. Comments rot. Some are useless. Don’t even get me started on doxygen comments.

        • 1984@lemmy.today
          link
          fedilink
          arrow-up
          8
          ·
          edit-2
          8 days ago

          Yeah I dont know why people dont do this. Then an overall description of the script at the top is enough and anyone can just look at function names to see what is going on.

        • Radioactive Butthole@reddthat.com
          link
          fedilink
          English
          arrow-up
          5
          ·
          8 days ago

          This is how I started writing my scripts and it is sublime. Even better is when your function can be a single return statement, makes writing tests easy.

  • Simulation6@sopuli.xyz
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    8 days ago

    Check-in rejected during code review. If you can’t summarize what you are doing, then you don’t really understand it. You may have to edit the comments after you have worked on it a bit and have a better understanding.

  • Artyom@lemm.ee
    link
    fedilink
    arrow-up
    11
    ·
    7 days ago

    Boto3 is an suite of AWS integration tools in case anyone else was wondering.