• some_guy@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 hours ago

    I’m so happy that, after I decided that I was gonna close Lemmy after reading the posts on the current page, this was the last one. What a great way to wrap up and go about my day after horrible current events and such.

  • RedFrank24@piefed.social
    link
    fedilink
    English
    arrow-up
    37
    ·
    2 days ago

    Anyone who complains about code not compiling on the first try likely hasn’t been coding for very long. Getting your code to do what you tell it is easy, getting it to do what you want is hard.

    • ClownStatue@piefed.social
      link
      fedilink
      English
      arrow-up
      12
      ·
      2 days ago

      Getting your code to do what you tell it is easy. Getting it to do what you want is hard.

      New email signature unlocked.

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      arrow-down
      2
      ·
      1 day ago

      Anyone who doesn’t complain about code not compiling on the first try likely writes dead simple programs and could be replaced by an LLM. Writing simple programs is easy, writing complex programs is hard.

      • Beanie@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        4 hours ago

        i mean, yeah? but also the language doesn’t become more complicated with larger programs and you typically don’t spit out thousands of lines of code without compiling at least some of it at least once

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          2 hours ago

          Most programmers I know compile a program when they have fully expressed an idea they have in their heads. It might just be the first outline of the idea. But, it’s a solid first sketch that contains all the key details. Unfortunately, often that’s a complex idea so it can be somewhere on the order of an hour before they stop coding and try compiling. One reason for that is that compiling the program is a context switch, and when they context switch they can’t keep all of their thoughts about the program in their head, instead they have to think about compiling. And, if compiling takes more than a few seconds their attention also starts to drift to other things.

          Coding for something like an hour without making a single typo or braino is difficult. This is especially true if the programmer is attempting to express a creative idea. Their focus won’t be on getting every single detail correct, it will be in sketching the shape of the idea as completely as possible. 99% of the time, those mistakes are entirely obvious and take no time to fix. But the compiler is (luckily) unforgiving of errors, even if the fix is obvious. But, that’s why it’s suspicious if the code compiles perfectly the first time.

          It’s possible that some people have different workflows. Maybe they write out the entire program in comments and pseudocode before using an actual programming language. If you do that, then you can probably afford to take a break from the actual coding more often and compile what you have so far. Maybe you’re compiling every 5 minutes instead of every 30, in which case it’s pretty normal not to have any compiler errors. Maybe some people use a super advanced IDE that effectively compiles the code in the background all the time and flags errors that will become compiler errors. I think a lot of people who became programmers before that kind of thing was popular find that sort of thing to be distracting. If they’re trying to write something on line 50 and the IDE flags something from line 45, they might have already shifted their context a bit, and having to go back and fix that will distract them from the thing they’re currently trying to express.

          Personally, I’ve often had no compiler errors when writing tests. Tests are often very small, self-contained bits of code that don’t take long to write, and aren’t very complex, so it’s pretty normal to have a test compile and run perfectly the first time.

          The point is, programmers who have been programming for a long time are the ones who are more likely to be surprised if their code compiles perfectly the first time.

          • wpb@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            1 hour ago

            Unfortunately, often that’s a complex idea so it can be somewhere on the order of an hour before they stop coding and try compiling.

            Maybe I’ve been lucky with the people I got to work with so far (and I definitely am), but I know of no professional software engineer that would voluntarily subject themselves to such a long feedback loop. I guess some of the juniors try to work this way sometimes, but they learn fairly quickly not to. The best ones I know work incrementally. Small change, run, small change run, and so on.

            • merc@sh.itjust.works
              link
              fedilink
              arrow-up
              1
              ·
              27 minutes ago

              Small change and run works for small ideas. Sometimes you have a big idea that’s hard to break down into small chunks.

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 days ago

      When I started programming with C, it was pretty easy to get code to compile on my first try.

      Now, when I use C…
      _POSIX_C_SOURCE >= 199309L … was in the man page, but didn’t work… _GNU_SOURCE works.
      Read somewhere to just use -std=gnu17 and remove _GNU_SOURCE and nice, it works.
      Create another project with -std=gnu17, but using another function and now it doesn’t work. Need to add _GNU_SOURCE. Why?

    • schnurrito@discuss.tchncs.de
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      I usually code in an IDE that tells me whether my code will compile while I am typing it.

      But when I write things like PL/SQL, yeah it is definitely an achievement to get it to compile.

      • OpenStars@piefed.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 day ago

        Have you ever tried compiling your BASH scripting code? Man, that’s like, almost literally impossible! :-P