By “good” I mean code that is written professionally and concisely (and obviously works as intended). Apart from personal interest and understanding what the machine spits out, is there any legit reason anyone should learn advanced coding techniques? Specifically in an engineering perspective?

If not, learning how to write code seems a tad trivial now.

  • edgemaster72@lemmy.world
    link
    fedilink
    arrow-up
    67
    ·
    edit-2
    2 months ago

    understanding what the machine spits out

    This is exactly why people will still need to learn to code. It might write good code, but until it can write perfect code every time, people should still know enough to check and correct the mistakes.

    • visor841@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      2 months ago

      For a very long time people will also still need to understand what they are asking the machine to do. If you tell it to write code for an impossible concept, it can’t make it. If you ask it to write code to do something incredibly inefficiently, it’s going to give you code that is incredibly inefficient.

      • 667@lemmy.radio
        link
        fedilink
        English
        arrow-up
        12
        ·
        edit-2
        2 months ago

        I used an LLM to write some code I knew I could write, but was a little lazy to do. Coding is not my trade, but I did learn Python during the pandemic. Had I not known to code, I would not have been able to direct the LLM to make the required corrections.

        In the end, I got decent code that worked for the purpose I needed.

        I still didn’t write any docstrings or comments.

        • Em Adespoton@lemmy.ca
          link
          fedilink
          arrow-up
          9
          ·
          2 months ago

          I would not trust the current batch of LLMs to write proper docstrings and comments, as the code it is trained on does not have proper docstrings and comments.

          And this means that it isn’t writing professional code.

          It’s great for quickly generating useful and testable code snippets though.

          • GBU_28@lemm.ee
            link
            fedilink
            English
            arrow-up
            3
            arrow-down
            1
            ·
            2 months ago

            It can absolutely write a docstring for a provided function. That and unit tests are like some of the easiest things for it, because it has the source code to work from

    • scarabic@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      2 months ago

      I’ve even seen human engineers’ code thrown out because no one else could understand it. Back in the day, one webdev took it upon himself to whip up a mobile version of our company’s very complex website. He did it as a side project. It worked. It was complete. It looked good. It was very fast. The code was completely unreadable by anyone else. We didn’t use it.

  • AwkwardLookMonkeyPuppet@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months ago

    Absolutely, but they need a lot of guidance. GitHub CoPilot often writes cleaner code than I do. I’ll write the code and then ask it to clean it up for me and DRYify it.

  • cley_faye@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    For repetitive tasks, it can almost automatically get a first template you write by hand, and extrapolate with multiple variations.

    Beyond that… not really. Anything beyond single line completion quickly devolves into either something messy, non working, or worse, working but not as intended. For extremely common cases it will work fine; but extremely common cases are either moved out in shared code, or take less time to write than to “generate” and check.

    I’ve been using code completion/suggestion on the regular, and it had times where I was pleasantly surprised by what it produced, but even for these I had to look after it and fix some things. And while I can’t quantify how often it happened, there are a lot of times where it’s convincing gibberish.

    • anytimesoon@feddit.uk
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I’ve also had some decent luck when using a new/unfamiliar language by asking it to make the code I wrote more idiomatic.

      It’s been a nice way to learn some tricks I probably wouldn’t have bothered with before

    • A_A@lemmy.world
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      2 months ago

      Yes … and it doesn’t know when it is on time.
      Also, machines are getting better and they can help us with inspiration.

  • nikaaa@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    my dad uses this LLM python code generation quite routinely, he says the output’s mostly fine.

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

        I use LLMs for C code - most often when I know full well how to code something but I don’t want to spent half a day expressing it and debugging it.

        ChatGPT or Copilot will spit out a function or snippet that’s usually pretty close to what I want. I patch it up and move on to the tougher problems LLMs can’t do.

  • TranquilTurbulence@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    Yes and no. GPT usually gives me clever solutions I wouldn’t have thought of. Very often GPT also screws up, and I need to fine tune variable names, function parameters and such.

    I think the best thing about GPTis that it knows the documentation of every function, so I can ask technical questions. For example, can this function really handle dataframes, or will it internally convert the variable into a matrix and then spit out a dataframe as if nothing happened? Such conversions tend to screw up the data, which explains some strange errors I bump into. You could read all of the documentation to find out, or you could just ask GPT about it. Alternatively, you could show how badly the data got screwed up after a particular function, and GPT would tell that it’s because this function uses matrices internally, even though it looks like it works with dataframes.

    I think of GPT as an assistant painter some famous artists had. The artist tells the assistant to paint the boring trees in the background and the rough shape of the main subject. Once that’s done, the artist can work on the fine details, sign the painting, send it to the local king and charge a thousand gold coins.

  • DeLacue@lemmy.world
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    2 months ago

    That all depends on where the data set comes from. The code you’ll get out of an LLM is the average code of the data set. If it’s scraped from the internet (which is very likely) the code you’ll get will be an amalgam of concise examples from one website, incorrect examples from another, bits from blogs with all the typos and all the gunk and garbage that’s out there.

    Getting LLM code to work well takes an understanding of what the code it gives you actually does and why it’s bad. It will always be bad because it cannot be better than the dataset and in order for a dataset to be big enough to train an LLM it’ll have to have everything they can get including all the trash. But it can be good for providing you a framework to start with. It is however never going to replace actual programming and understanding of programming. The talk of LLMs completely replacing programers is mostly coming from people who do not understand coding or LLMs at all.

    • GrammarPolice@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      6
      ·
      2 months ago

      Can’t LLM’s eventually gain some form of “sentience”, and be able to self correct? A sort of thinking before speaking kind of situation.

      • DeLacue@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        2 months ago

        This question right here perfectly encapsulates everything wrong with LLMs right now. They could be good tools but the people pushing them have no idea what they even are. LLMs do not make decisions. All the decisions an LLM appears to make were made in the dataset. All those things that an LLM does that make it seem intelligent were done or said by a human somewhere on the internet. It is a statistical model that determines what output is mostly likely to come next. That is it. It is nothing else. It is not smart. It does not and cannot make decisions. It is an algorithm that searches a dataset and when it can’t find something it’ll provide convincing-looking gibberish instead.

        Listen think of it like this; a man decides to take exams to become a doctor in France, but for some reason he doesn’t learn either french or medicine. No, no instead he studies every former exam and all the answers to them. He gets very good at regurgitating those answers so much so that he can even pass the exam. But at no point does he understand what any of it means and when asked new and novel questions he provides utter nonsense answers. No matter how good he gets at memorising those answers he will never get any better at medicine. LLMs are as likely to gain sentience as my excel spreadsheets are.

        • hikaru755@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          2 months ago

          It is an algorithm that searches a dataset and when it can’t find something it’ll provide convincing-looking gibberish instead.

          This is very misleading. An LLM doesn’t have access to its training dataset in order to “search” it. Producing convincing looking gibberish is what it always does, that’s its only mode of operation. The key is that the gibberish that comes out of today’s models is so convincing that it actually becomes broadly useful.

          That also means that no, not everything an LLM produces has to have been in its training dataset, they can absolutely output things that have never been said before. There’s even research showing that LLMs are capable of creating actual internal models of real world concepts, which suggests a deeper kind of understanding than what the “stochastic parrot” moniker wants you to believe.

          LLMs do not make decisions.

          What do you mean by “decisions”? LLMs constantly make decisions about which token comes next, that’s all they do really. And in doing so, on a higher, emergent level they can make any kind of decision that you ask them to, the only question is how good those decisions are going be, which in turn entirely depends on the training data, how good the model is, and how good your prompt is.

  • daniskarma@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    2 months ago

    For small boilerplate or very common small pieces of code, for instance a famous algorithm implementation. Yes. As they are just probably giving you the top stack overflow answer for a classic question.

    Anything that the LLM would need to mix or refactor would be terrible.

  • JeeBaiChow@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    Dunno. I’d expect to have to make several attempts to coax a working snippet from the ai, then spending the rest of the time trying to figure out what it’s done and debugging the result. Faster to do it myself.

    E.g. I once coded Tetris on a whim (45 min) and thought it’d be a good test for ui/ game developer, given the multi disciplinary nature of the game (user interaction, real time engine, data structures, etc) Asked copilot to give it a shot and while the basic framework was there, the code simply didn’t work as intended. I figured if we went into each of the elements separately, it would have taken me longer than if i’d done it from scratch anyway.

  • recapitated@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    2 months ago

    I’m my experience they do a decent job of whipping out mindless minutea and things that are well known patterns in very popular languages.

    They do not solve problems.

    I think for an “AI” product to be truly useful at writing code it would need to incorporate the LLM as a mere component, with something facilitating checks through static analysis and maybe some other technologies, maybe even mulling the result through a loop over the components until they’re all satisfied before finally delivering it to the user as a proposal.

    • Croquette@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      It’s a decent starting point for a new language. I had to learn webdev as an embedded C coder, and using a LLM and cross-referencing the official documentation makes a new language much more approachable.

      • recapitated@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        I agree, LLMs have been helpful in pointing me in the right direction and helping me rethink what questions I actually want to ask in disciplines I’m not very familiar with.

    • thanks_shakey_snake@lemmy.ca
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      Those kinds of patterns are already emerging! That “mulling the result through a loop” step is called “reflection,” and it does a great job of catching mistakes and hallucinations. Nothing is on the scale of doing the whole problem-solving and implementation from business requirements to deployed product-- probably never will be, IMO-- but this “making the LLM a component in a broader system with diverse tools” is definitely something that we’re currently figuring out patterns for.

  • saltesc@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 months ago

    In my experience, not at all. But sometimes they help with creativity when you hit a wall or challenge you can’t resolve.

    They have been trained off internet examples where everyone has a different style/method of coding, like writing style. It’s all very messy and very unreliable. It will be years for LLMs to code “good” and will require a lot of training that isn’t scraping.

  • Arbiter@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 months ago

    No LLM is trust worthy.

    Unless you understand the code and can double check what it’s doing I wouldn’t risk running it.

    And if you do understand it any benefit of time saved is likely going to be offset by debugging and verifying what it actually does.

    • FlorianSimon@sh.itjust.works
      link
      fedilink
      arrow-up
      7
      ·
      2 months ago

      Since reviewing code is much harder than checking code you wrote, relying on LLMs too heavily is just plain dangerous, and a bad practice, especially if you’re working with specific technologies with lots of footguns (cf C or C++). The amount of crazy and hard to detect bad things you can write in C++ is insane. You won’t catch CVE-material by just reading the output ChatGPT or Copilot spits out.

      And there’s lots of sectors like aerospace, medical where that untrustworthiness is completely unacceptable.

  • Red_October@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    Technically it’s possible, but it’s neither probable nor likely, and it’s especially not effective. From what I understand, a lot of devs who do try to use something like ChatGPT to write code end up spending as much or more time debugging it, and just generally trying to get it to work, than they would have if they’d just written it themselves. Additionally, you have to know how to code to be able to figure out why it’s not working, and even when all of that is done, it’s almost impossible to get it to integrate with a larger project without just rewriting the whole thing anyway.

    So to answer the question you intend to ask, no, LLMs will not be replacing programmers any time soon. They may serve as a tool of dubious value, but the idea that programmers will be replaced is only taken seriously by by people who manage programmers, and not the programmers themselves.