• Honytawk@lemmy.zip
    link
    fedilink
    arrow-up
    170
    ·
    4 months ago

    Same with BIOS descriptions.

    FGTSAB switch [toggles the FGTSAB setting]

    infuriating

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

            And who updates that documentation three months later when a bug gets fixed or a new requirement get implemented?

            • Dropkick3038@programming.dev
              link
              fedilink
              arrow-up
              2
              ·
              4 months ago

              The person who changed the code, it’s just ordinary maintenance. The comments may not execute, but I submit they are as much a part of the program as the executable code. Maybe over time those comments are condensed, or even removed; no different than any other refactoring or cleanup.

    • BenLeMan@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      4 months ago

      Yup, my first thought as well. While those days are thankfully over, those braindead BIOS “help” messages remain etched into my mind forever.

      • RogueBanana@lemmy.zip
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 months ago

        Are the recent ones any better? I got a gigabyte b660m for 12th gen intel and it’s really bad at that. Had to look up a lot to figure out things.

        • BenLeMan@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          4 months ago

          Maybe it’s an ASUS thing but both my current and previous boards have been pretty good with the help texts.

          • Honytawk@lemmy.zip
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            4 months ago

            Snapmaker Luban is amazing with its help messages.

            Every setting in this 3D slicer is completely explained how the setting works, what the different options are, with pictures and even what every option is the most optimal in whatever situation.

            Too bad that it isn’t the best program unless you have a Snapmaker, and even then…

    • ඞmir@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      4 months ago

      Love having to enable “support for sleep state 5” to turn off USB power when the PC is off

  • SlopppyEngineer@lemmy.world
    link
    fedilink
    arrow-up
    95
    ·
    4 months ago

    Best comment ever was “It used to work like this but person at client demanded it work like that on this date” when the client complained it shouldn’t work like that.

    • conciselyverbose@sh.itjust.works
      link
      fedilink
      arrow-up
      106
      ·
      4 months ago

      That’s basically what comments are most useful for. When you’re doing something that’s not obvious, and want to make sure the “why” doesn’t get lost to time.

    • The best comments are “why” comments, the runner up is “how” comments if high-level enough, and maybe just don’t write “what” comments at all because everyone reading your code knows how to read code.

    • jaybone@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      4 months ago

      That’s actually the perfect comment, because if anyone ever comes back to fuck with you about it, it’s explained right there. Then you turn it right back around on management and watch them run around like chickens with their heads cut off.

      • lad@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Out management used to tell us, that even if head of department had committed to doing something some way, there’s no way or need to hold them accountable. It’s just that situation has changed, and nobody should bat an eye.

        To be fair, they also did not pressure us much for the missed deadlines or missing features, because it was indeed the result of the situation described in the first paragraph

    • tiredofsametab@kbin.run
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      I was porting our old code from PHP to Go at a previous company. I laughed as I copied my then-six-year-old comment “I’m promised by xxxxx that this is a temporary measure <link to slack convo>”.

  • yetAnotherUser@discuss.tchncs.de
    link
    fedilink
    arrow-up
    61
    ·
    4 months ago
    /*
     * Gets stupidFuckingInteger
     *
     * @returns stupidFuckingInteger
    */
    public double getStupidFuckingInteger() {
        return stupidFuckingInteger;
    }
    
    
    • Shoe@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      Have reviewed 16 year old code for a very well known company in the last week with this exact comment peppered throughout, alongside delightfully helpful comments like:

      // do not delete or change this it just works

      // TODO temporary fix added 12/09/11 to fix incident must be removed ASAP

      // CAUTION this returns false here instead of true like it normally does, not sure why

      // if true then matched to valid account not is true

    • smeg@feddit.uk
      link
      fedilink
      English
      arrow-up
      47
      ·
      edit-2
      4 months ago

      The allowable exception is when the what is a what the fuck, as in you had to use a hack so horrible that it requires an apology comment

      • Martin@feddit.nu
        link
        fedilink
        arrow-up
        10
        ·
        4 months ago

        Absolutely, although I see that as part of why

        Why is there a horrible hack here? Because stupid reason…

      • lad@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        ·
        4 months ago

        Or if the what is so cryptic and esoteric that it would require the reader a couple hours of research to understand it.

        Also, I find it useful to summarise the what before code blocks if that can’t be summarised in a function name

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 months ago

        Describing the what also helps when you dabble in a new technology or little-used technology. It helps to explain to yourself what you’re doing and it helps in onboarding. “Hey, newbie, there’s a function in XYZ module that’s extensively documented. Look there for guidance.”

    • azdle@news.idlestate.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      4 months ago

      Unless you’re working with people who are too smart, then sometimes the code only explains the how. Why did the log processor have thousands of lines about Hilbert Curves? I never could figure it out even after talking with the person that wrote it.

  • Johanno@feddit.org
    link
    fedilink
    arrow-up
    37
    ·
    4 months ago

    I write such comments because I have to.

    Company policy.

    Also we have to specify every line of code and what it should do…

    • ulterno@lemmy.kde.social
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      4
      ·
      4 months ago

      I feel like I am going to have to do the same thing in the end, to get my hand-over accepted.
      Should I just copy the line of code and make a comment next to it with:

      // It does <paste line of code>
      

      CC BY-NC-SA 4.0

        • ulterno@lemmy.kde.social
          link
          fedilink
          English
          arrow-up
          11
          arrow-down
          5
          ·
          4 months ago

          Not every. The quick, very-low effort ones, I just leave.

          Why:
          I saw another post with “Anti Commercial AI License”, then wen on to read the license and went, “Neat!”.

          • It makes it easier for anyone to decide what to do if they want to use my comment/post (in cases where it actually has something useful)
          • It makes life just a bit harder for people data-mining for AI
            • That way, some data entry worker will probably ask for a raise and probably even get it and maybe some entrepreneur going “AI everywhere!” will think twice.
            • Or there will be a chatbot spouting “Anti Commercial AI License” or “CC By-NC-SA” in their answer text, which would be hilarious.

          CC BY-NC-SA 4.0

          • communism@lemmy.ml
            link
            fedilink
            arrow-up
            5
            ·
            4 months ago

            How are you inserting your signature? is it manually? Do you have some kind of keyboard shortcut to insert it?

            • ulterno@lemmy.kde.social
              link
              fedilink
              English
              arrow-up
              5
              arrow-down
              1
              ·
              edit-2
              4 months ago

              For now, I have just saved it in my clipboard application, so I copy-paste.
              When it goes out of history, I just open a file, where I have saved it and copy from there. So it’s pretty crude.

              I was hoping that either the KDE Social web interface would add a “Signature” feature or I would pick some Lemmy application that would allow that, but for now it’s just this.

              Perhaps, if I feel like it’s being too frequent, I may set a compose key for it.

              CC BY-NC-SA 4.0

  • nikaaa@lemmy.world
    link
    fedilink
    arrow-up
    20
    arrow-down
    6
    ·
    4 months ago

    Good code is self-explanatory. You should only comment your code if it does something unexpectedly complicated.

    That being said, it’s always a good idea to write a manual, about how to use the code. Don’t document how it works, because those who can code will understand it anyways, and those who can’t, have no need to understand it.

    • BorgDrone@lemmy.one
      link
      fedilink
      arrow-up
      26
      ·
      4 months ago

      Good code is self-explanatory. You should only comment your code if it does something unexpectedly complicated.

      The code shows what is being done. The comments should explain the why.

      • Pasta Dental@sh.itjust.works
        link
        fedilink
        arrow-up
        10
        ·
        edit-2
        4 months ago

        Yes. This 1000x. I hate it at work when I come across code that was written 3 years ago that has literally no traces of why it’s there and a quick summary of what it does. Especially because that code is always the most abbreviated spaghetti you’ve ever seen. People should stop thinking (their) code documents itself because 99.999% of programmers cannot do it right.

        I really like the Google way of coding: assume the person reading the code is the most 1337 programmer ever, BUT that this person knows absolutely nothing about the project

        • BorgDrone@lemmy.one
          link
          fedilink
          arrow-up
          7
          ·
          4 months ago

          Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

      • dan@upvote.au
        link
        fedilink
        arrow-up
        10
        ·
        4 months ago

        This is something a lot of people don’t seem to understand. Even if code is self-explanatory, I want to know why it was designed that way.

        I’ve fixed bugs where the fix was only a one line change, but it was extremely difficult to figure out, so I left a 10ish line comment above it explaining why it has to be done that way.

    • potustheplant@feddit.nl
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      4 months ago

      Hard disagree. It’s a lot easier and faster to understand a function that is prefaced with a small line of text explaining what it does rather than trying to figure it out yourself.

      It’s not about whether you can understand the code or not, it’s about efficiency and clarity.

      • Aurelius@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        4 months ago

        Yeah, just 15 seconds and jot down a comment. Whenever I’m even hesitant, I just leave a comment. Doesn’t hurt anything and it can always be removed if not needed

        Easier to remove later rather than add it after the fact

      • Aux@lemmy.world
        link
        fedilink
        arrow-up
        4
        arrow-down
        3
        ·
        4 months ago

        Hard disagree - that’s just dumb:

        // Calculates tax
        function calculateTax() { }
        
        • uis@lemm.ee
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          edit-2
          4 months ago

          Hard disagree - that’s very helpful:

          // Calculates Personal Income Tax by formula from section 1.2.3 of tax code. Other taxes like VAT are not calculated.
          function calculateTax() { }
          
          • Aux@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            4
            ·
            4 months ago

            If it calculates personal income tax, just call calculatePersonalIncomeTax.

              • usernamefactory@lemmy.ca
                link
                fedilink
                arrow-up
                3
                ·
                4 months ago

                I’m a new developer. Is that referring to page 123 of the in-house documentation? Version 12.3 of the code? I have no clue.

                You’d have to call it something like calculatePersonalIncomeTaxPerTaxCodeSection1_2_3, but I get exhausted just looking at that. There comes a point where the cognitive work of reading crazy long camel case names is more trouble than it’s worth.

                An explanation of what specification a function was written to implement is a perfectly appropriate comment. Could be improved by a direct link where possible. But it’s worth noting what that comment isn’t doing - specifying any implementation details. For that, I really can just read the code.

      • weststadtgesicht@discuss.tchncs.de
        link
        fedilink
        arrow-up
        3
        arrow-down
        3
        ·
        4 months ago

        If done right, the “what it does” is in the method name. If your method is too complicated to summarize in its name, chances are good you should split it up or extract parts of it.

    • tiredofsametab@kbin.run
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      Asinine business logic can still make some things very hard to read and digest no matter how well-planned and well-written it is (particularly if it is rushed by the business meaning that engineers don’t have time to do it well). As such, there are places where code can’t/won’t be self-documenting to a useful degree.

  • ClassifiedPancake@discuss.tchncs.de
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    At work we let Typescript and descriptive naming document our code. Only when something is a workaround or otherwise weird will we add comments. So far it has worked great for us.

  • KillingTimeItself@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    10
    ·
    edit-2
    4 months ago

    this is why i very rarely comment with descriptive comments. If you’re reading my code and don’t understand what it is, even with how shit it is, you have no business reading whatever fucking crackpot shit im writing.

        • potustheplant@feddit.nl
          link
          fedilink
          arrow-up
          3
          ·
          4 months ago

          Doesn’t matter. Even if it’s your code, you might revisit something you made months or a year after doing it and having comments will speed up your work. It’s a very basic good practice.

          • KillingTimeItself@lemmy.dbzer0.com
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            4 months ago

            i do have comments, for some things, but there are a lot of “commenting” standards that are just shit. I find i don’t care what the actual piece of code is doing, i care more about it’s place in the rest of the code, and i’d much rather have “anti comments” instead.