• farmgineer@nord.pub
    link
    fedilink
    English
    arrow-up
    120
    arrow-down
    2
    ·
    2 months ago

    I was doing a code review this week. There was nothing wrong with the code in terms of structure or performance, but it was doing this really weird operation with an ID after DB insert. I asked about it and the author was like “yeah, that’s weird; I don’t know why the AI did that. I’ll remove it.” My dude, I know you can write good code. Don’t be lazy!

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

      i dont understand that. i use ai for help reading through old stuff or to help me remember how tondo a thing i havent done in two years but blindly copy pasting blows my mind.

      • saltesc@lemmy.world
        link
        fedilink
        English
        arrow-up
        27
        arrow-down
        2
        ·
        2 months ago

        Same. I also code up about 50% of stuff so all the structure is there, effectively as guardrails, before using AI. Then prompting it instructions that are effectively the solution, so it doesn’t come up with its own.

        Then, read through it all, replace things that could’ve been done better, and test.

        On average it’s maybe 15-20% quicker than manually coding the whole lot. Try skip any of those steps and the chances of it blowing out increase to the point I just end up doing it all anyway and it’s taken twice as long because of it.

        It’s alarming when people don’t even check.

        • gnutrino@programming.dev
          link
          fedilink
          English
          arrow-up
          9
          ·
          2 months ago

          On average it’s maybe 15-20% quicker than manually coding the whole lot.

          Out of interest, how much is this 15-20% increase in productivity costing in tokens?

          • phutatorius@lemmy.zip
            link
            fedilink
            English
            arrow-up
            5
            ·
            2 months ago

            You’d really need to know the fully burdened cost of an hour of the person’s time who’d be doing the work, versus the cost of the tokens plus all the overheads involved in its administration and use of the AI solution (tokens, support, training). Same goes with the downsides-- you’d need to know how the rate of serious bugs changes when you incorporate the slop. Some of the defects will make it through reviews and testing and into prod.

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

            It’d be minimal since I’m doing all the hard work initially and feeding it logic to follow. I find open vibe coding does rip tokens and usually ends up with an overcomplicate mess. Many rabbit holes the AI creates and sends itself down, so a lot more unnecessary lines and often entire redundant blocks.

            If someone’s going to do that, at the least break it up into sections to save tokens and time. But ideally, just get some coding experience under the belt of have a crack at it yourself first so it’s easy to identify the pitfalls and where clear instructions is needed.

            • Mirror Giraffe@piefed.social
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 month ago

              I’ve been vibing a bit in my spare time, and in the beginning I didn’t look too much at the cost because I was more interested in quickly reaching some sort of mvp state but then I had to manually troubleshoot a thing and wow it was so full of hardcoded bullshit, which was so insanely far from how I was im envisioning it.

              I had to backtrack a lot and then started doing like you and tell it what I wanted the code to look like.

      • Kissaki@feddit.org
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 months ago

        If the AI generates code in place, you don’t have to copy and paste anything. They’d have to do a self-review to spot such an issue. And then notice and act upon it.

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

      I worked with a guy that 100% used AI to dev everything. didn’t even check to see if it would work before submitting a MR.

      It got to the point that I stopped reviewing them and just rejected them outright with a simple comment, “doesn’t work”.

      eventually he was fired. the evidence? the four months of shitty MRs he opened. the best part was, when I said “doesn’t work”, I was never wrong. none of his changes worked.

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

      Yeah these interaction are becoming quite fraught because there is extreme danger of AI use just shifting the burden from one person to another. That guy wrote the code super fast with AI, but you had to do an additional round trip during code review with him to eliminate that weirdness. He gets a bonus for doing twice the work in half the time, you get nothing.

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

      I know it’s because LLMs are bad at what they do, but I like to imagine that all these weird things getting slipped into code are an attempt to create skynet without us noticing

    • ThomasWilliams@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      There was nothing wrong with the code in terms of structure or performance, but it was doing this really weird operation with an ID after DB insert

      So there was plenty wrong with the code.

      And it hasn’t been fixed.

      “Bro, its totally just you prompted it wrong”