“No Duh,” say senior developers everywhere.

The article explains that vibe code often is close, but not quite, functional, requiring developers to go in and find where the problems are - resulting in a net slowdown of development rather than productivity gains.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    20 days ago

    I really disagree here. If someone else is writing your unit tests, that means one of the following is true:

    • the tests are written after the code is merged - there will be gaps, and the second dev will be lazy in writing those tests
    • the tests are written before the code is worked on (TDD) - everything would take twice as long because each dev essentially needs to write the code again, and there’s no way you’re going to consistently cover everything the first time

    Devs should write their tests, and reviewers should ensure the tests do a good job covering the logic. At the end of the day, the dev is responsible for the correctness of their code, so this makes the most sense to me.

    • Nalivai@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      19 days ago

      the tests are written after the code is merged - there will be gaps, and the second dev will be lazy in writing those tests

      I don’t really see how this follows. Why do the second one necessary have to be lazy, and what stops the first one from being lazy as well.
      The reason I like it to be different people is so there are two sets of eyes looking at the same problem without the need for doing a job twice. If you miss something while implementing, it’s easier for you to miss it during test writing. It’s very hard to switch to testing the concept and not the specific implementation, but if you weren’t the one implementing it, you’re not “married” to the code and it’s easier for you to spot the gaps.

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        19 days ago

        Devs are more invested in code they wrote themselves. When I’m writing tests for something I didn’t write, I’m less personally invested in it. Looking at PRs by other devs when we do pushes for improving coverage, I’m not alone here. That’s just human psychology, you care more about things you built than things you didn’t.

        I think testing should be an integral part of the dev process. I don’t think any code should be merged until there are tests proving its correctness. Having someone else write the tests encourages handing tests to jr devs since they’re “lower priority.”

        • Nalivai@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          10 hours ago

          Devs are more invested in code they wrote themselves. When I’m writing tests for something I didn’t write, I’m less personally invested in it.

          This, I think, is a very bad part of the problem and shouldn’t be happening regardless

            • Nalivai@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              4 hours ago

              I absolutely don’t. Since we’re talking about bad cases anyway, I don’t trust a developer to be diligent in finding bugs in their code more than I believe they will try to make all the tests pass. And it’s easier and better for the ego to achieve that if you write shit tests that only cover cases that you know will work.

              • sugar_in_your_tea@sh.itjust.works
                link
                fedilink
                English
                arrow-up
                1
                ·
                edit-2
                4 hours ago

                Unit tests aren’t intended to find bugs, they’re intended to prove correctness. There should be a separate QA process for finding bugs, which involves integration testing. When QA inevitably finds a bug, the unit tests get updated with that case (and any similar cases).

                only cover cases that you know will work

                And that’s what code reviews are for. If your tests don’t sufficiently cover the logic, the change should be rejected until they do. It’s a lot easier to verify the tests cover the logic if the tests are submitted w/ the logic changes.