• Slashme@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    4 days ago

    Remember that Fortran has an arithmetic if statement. You can write

    IF (expression) s1, s2, s3
    

    where s1, s2 and s3 are labels. If the expression is negative, it jumps to s1. If it’s 0, to s2 and if it’s positive, to s3.

    It also has goto variable. You can do

    INTEGER a
    ASSIGN 20 TO a
    ASSIGN 17 TO a
    GO TO a
    20 PRINT *, "foo"
    17 PRINT *, "bar"
    

    and it’ll print “bar”. In this snippet of code, everything seems quite logical, but imagine debugging spaghetti code written using these patterns.

    Oh, it also has

    GO TO (s1, s2, ... , sn), N
    

    First, N is converted to an integer. If N is 1, it goes to label s1. If N is 2, it goes to s2. If N is less than 1 or greater than n, it does nothing.

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

    to be fair, I think such old codebase in that ancient of a language is going to have a lot of technical debt and predate maintainable code practices. I’d rather work with a modern language. Whatherver LLM spat out - having been trained on modern code - is going to be a lot more maintainable.

  • neidu3@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    126
    ·
    9 days ago

    Fortran. At least it was comprehensible to a human brain once upon a time. And probably efficiently written.

    • Kairos@lemmy.today
      link
      fedilink
      arrow-up
      46
      ·
      9 days ago

      If you’re good at assembly you’ll be fine once you get past the bad formatting, short names, etc. that was common at that time.

    • SpaceCowboy@lemmy.ca
      link
      fedilink
      arrow-up
      19
      ·
      9 days ago

      Yeah really. It would be some tough sledding at first, but it would be far better than looking at some code with some nicely named methods and variables with lots of comments (with emoticons!) for days… only to find out it does absolutely nothing.

    • Serinus@lemmy.world
      link
      fedilink
      arrow-up
      11
      ·
      9 days ago

      On the other hand, you know the Fortran works and you can break it.

      The vibe code is already broken.

      I’m still pounding the Fortran button as hard as I can.

  • deegeese@sopuli.xyz
    link
    fedilink
    arrow-up
    85
    ·
    9 days ago

    The Fortran is tight, works, and has 50 years of field testing.

    Much rather work on something old and proven than new and slapdash.

    • slothrop@lemmy.ca
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      9 days ago

      Watfor and Watfiv for the win, baby!
      Honourable mention to PL/1 and cobol…

  • Bubbaonthebeach@lemmy.ca
    link
    fedilink
    English
    arrow-up
    69
    ·
    8 days ago

    Code that has lasted, with some maintenance, for 50+ years vs code that doesn’t work from day 1? What advances we have made!

  • 14th_cylon@lemmy.zip
    link
    fedilink
    arrow-up
    38
    ·
    edit-2
    9 days ago

    the fortran code was probably written by someone who knew what they were doing and didn’t need 1 gb of libraries to implement the save button.

    and the fact that the code survived till today does say something about its quality. i don’t think this is hard choice.

    • bus_factor@lemmy.world
      link
      fedilink
      arrow-up
      15
      ·
      9 days ago

      That’s not a given. A friend of mine worked on a weather forecast implemented in Fortran by people who were better at meteorology than programming, and some functions had thousands of parameters. The parameters for one of the calls (not the function definition) were actually supplied in a separate include file.

      • AnarchistArtificer@slrpnk.net
        link
        fedilink
        English
        arrow-up
        3
        ·
        8 days ago

        I’m a biochemist who got into programming from the science side of it, and yeah, code written by scientists can be pretty bad. Something that I saw a lot in my field was that people who needed some code to do something as part of a larger project (such as adding back on the hydrogens to a 3d protein structure from the protein database) would write the thing themselves, and not even consider the possibility that someone else has probably written the same thing, but far better than they be can, and made it available open source. This means there’s a lot of reinventing the wheel by people who are not wheel engineers.

        I find it so wild how few scientists I’ve spoken to about this stuff understand what open-source code actually means in the wider picture. Although I’ve never spoken to a scientist in my field who doesn’t know what open source means at all, and pretty much all of them understand open source software as being a good thing, this is often a superficial belief based purely on understanding that proprietary software is bad (I know someone who still has a PC running windows 98 in their lab, because of the one piece of essential equipment that runs on very old, proprietary code that isn’t supported anymore).

        Nowadays, I’m probably more programmer than biochemist, and what got me started on this route was being aware of how poor the code I wrote was, and wanting to better understand best practices to improve things like reliability and readability. Going down that path is what solidified my appreciation of open source — I found it super useful to try to understand existing codebases, and it was useful practice to attempt to extend or modify some software I was using. The lack of this is what I mean by “superficial belief” above. It always struck me as odd, because surely scientists of all people would be able to appreciate open source code as a form of collaborative, iterative knowledge production

  • grue@lemmy.world
    link
    fedilink
    arrow-up
    32
    ·
    9 days ago

    I would genuinely love to find a job coding FORTRAN, mainly because it means I’d almost certainly be doing some kind of scientific computing. Way better than most tech jobs that involve boring CRUD work you don’t care about at best, or actively making the world worse implementing the whims of some billionaire sociopath at worst.

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      8 days ago

      Also, the code base will likely be pretty small. If something’s made to be delivered on punch cards and run on devices that measure their memory in KB or maybe MB, it’s not going to be a ton of code. Even if it’s pure assembly, it’s going to be easier than a huge automatically generated codebase.

        • squaresinger@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          8 days ago

          Compared with any modern codebase that’s still tiny.

          From what I can see Rollercoaster Tycoon was hand-written by a single person, so it by definition cannot be huge.

          • AnarchistArtificer@slrpnk.net
            link
            fedilink
            English
            arrow-up
            2
            ·
            8 days ago

            I wish that the code was open source, because it’d be super interesting to be able to look under the hood of a game like Rollercoaster Tycoon

            • squaresinger@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              8 days ago

              It kinda is. Assembly is a 1:1 machine-code equivalent, so you just have to run the game through a disassembler and you get the “source”. You just dont get the documentation.

  • kibiz0r@midwest.social
    link
    fedilink
    English
    arrow-up
    31
    ·
    9 days ago

    It’s weird that “legacy code” is a pejorative.

    If your code has lasted long enough to be considered “old”, but is still so useful that it can’t just be deleted without a dedicated replacement effort… it’s doing something right.

    • smeg@feddit.uk
      link
      fedilink
      English
      arrow-up
      10
      ·
      8 days ago

      it’s doing something right

      That’s where the problem lies, we know it’s doing something right but we don’t understand what or how it works, we’re too reliant on it to change it, and the workarounds we have to make to accommodate it are a pain in the arse.

    • spongebue@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      9 days ago

      I work with a different kind of legacy system. It was retrofitted to work with SOAP, OOP, and some other modern stuff, but none of the old farts bothered to learn it. When I inherited a SOAP service that system used, I had to learn a lot about it to get what I needed.

      And honestly? It’s been a lot of fun. It’s a unique kind of challenge, I’ve practically gained celebrity status at work, and even if it’s nothing I’ll be doing long-term it shows how I can pick up weird systems and work with others to make some miracles happen.

    • regdog@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      8 days ago

      Instead of “legacy code” they should call it “veteran code”, because it has seen some shit.

    • LeFantome@programming.dev
      link
      fedilink
      arrow-up
      8
      ·
      8 days ago

      Well obviously with vibe coded stuff, you just put the code back in the AI and ask for documentation.

      Problem solved. /s

        • NominatedNemesis@reddthat.com
          link
          fedilink
          arrow-up
          1
          ·
          7 days ago

          Funny thing is, I would do that if there are no requirements, and the vibecode is unreadable. I would let the token-predictor create the requirements, after proof-reading and correcting it, I would create cooked-down list and run through a manager for approval, then rewrite it from scratch. My limited time and precious brain cells are too valuable to waste on reading and deciphering the half ton of sh!t an LLM produced.

          If there are requirements (which are hardly applicable unfortunately) I would just rewrite the thing.