• marcos@lemmy.world
      link
      fedilink
      arrow-up
      75
      arrow-down
      1
      ·
      edit-2
      10 months ago
      /**
       * foobar(a, b)
       * foos up a with b.
       * Note: this should never work. Fooing is impossible, and the fact that this function achieves it serves only to prove God has a wicked sense of humor.
       */
      
      • devilish666@lemmy.worldOP
        link
        fedilink
        arrow-up
        18
        arrow-down
        1
        ·
        10 months ago

        And then some of your noob intern tried to compile it without reading the documentation & it’s worked flawlessly
        Where’s your god now…??

    • andrew@lemmy.stuart.fun
      link
      fedilink
      English
      arrow-up
      20
      arrow-down
      1
      ·
      10 months ago

      That’s the final invisible panel. Code that definitely won’t compile, does compile, and tests all pass.

  • hperrin@lemmy.world
    link
    fedilink
    arrow-up
    72
    arrow-down
    1
    ·
    10 months ago

    It always gives me an uneasy feeling when I try to run code I just wrote and it works the first time.

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      24
      ·
      10 months ago

      When I first code something up, I think of it as a first draft, and I expect maybe 5ish typos / brainos per 100 lines. Only a few times in my life have I finished writing a few hundred lines of code, tried to compile / run it, and not seen at least a few errors.

      When I don’t see errors, it’s almost always because somehow I managed to not compile / run the code at all. Like, one of my typos / brainos managed to cause it to skip that entire new block of code. Only once or twice has it happened because I actually wrote error-free code the first time. And, let me tell you, that perfect code sucked up so much more time than the more typical bad code.

      With the bad code, I see the various errors, quickly fix them, and those errors convince me that the compiler / interpreter has actually seen all the new stuff and judged it. But, with perfect-from-the-start code, I now have to go in and throw in print statements, or step through a debugger to convince myself that yes, the system actually made it into that function and actually did execute those statements.

    • nexussapphire@lemm.ee
      link
      fedilink
      English
      arrow-up
      9
      ·
      10 months ago

      It must be cosmic rays, a bit flipped while compiling. No way I got it right the first time.

  • ShortN0te@lemmy.ml
    link
    fedilink
    arrow-up
    26
    arrow-down
    1
    ·
    10 months ago

    Happened a few times to me. Always make sure that you have saved every file correctly and that you compile the correct project. And that there are no cached files or somewhat somewhere.

  • TunaCowboy@lemmy.world
    link
    fedilink
    arrow-up
    4
    arrow-down
    14
    ·
    10 months ago

    Coder you know can’t program, programs.

    You should be able to debug/profile/trace your way to understanding, otherwise that impostor feeling isn’t a syndrome.