• MystikIncarnate@lemmy.ca
        link
        fedilink
        English
        arrow-up
        6
        ·
        4 months ago

        I don’t code, at best I script. I’m a sysadmin, not a dev, so I play around in PowerShell mostly.

        I just started to naturally do all of this. Not because I was taught to, but because I’ve written too many scripts that I later looked at, and thought, WTF is going on here… Who tf wrote this? (Of course it was me)…

        So instead of confusing my future self, I started putting in comments. One at the beginning to describe what the file name can’t, and inline comments to step me through what’s happening, and more importantly why I did what I did.

        The sheer number of comments can sometimes double the number of lines in my script, but later when I’m staring into the abyss of what I wrote, I appreciate me.

    • myplacedk@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      I agree.

      I usually think of that as documentation, not comments.

      But even so, the code should say what it does, with a good name. The documentation adds details.