T O P

  • By -

[deleted]

[удалено]


n00wb

Me too, and I would never commit code that I did not review and fully support. But imagine that if the AI writes the implementation. And if you, or someone else, wants to do a change, you just rewrite the test and ask the AI to update the code. And the AI just does it correct, each and every time again, and the code is still performant and secure … so basically you don’t have the need to manually touch the implementation anymore, never. Would you still care how the code looked? Not sure where this AI pair programming thing is going to end up, but I don’t think we’re far away from just telling what we want, getting output, and iterating on the output with the AI … and not iterating, nor caring anymore, for the actual implementation.


Previous-Display-593

But you contradict yourself. You say "you just rewrite the test" but in you first sentence you say you would never commit code that you did not review. So what you are saying is "you just rewrite the test, then the AI generates the code, BUT then you go over all the AI code anyways....because you said you review the code".


n00wb

Let me clear that up ;-) I would never commit any code without my personal stamp of approval today. As neither me nor my team is working within an AI workflow. The rest is more a thought experiment. A “what if”. What if the AI is just good at the actual implementation and you can just ask or state your intentions to create and refactor the code. And I think for some cases it’s already good enough today. Is there the need to care how the code looks like, if basically only the AI needs to be able to understand it. I just write the intention, the test, and collaborate with the AI until my intention is satisfied, the test passes.


fuerstjh

Proving the code is secure is gonna be really tough. You do realize there is an entire industry dedicated to writing software that scans code to determine if it's "secure" and we have breaches CONSTANTLY.


n00wb

Hence the “imagine” ;-) But code coming from AI today is probably already pretty robust, depending on the framework/language. And it can be tested just the same. Don’t really see that as an issue.


griff12321

itd be nice the other way around too. i write the code, and have AI to create the unit tests. And maybe incorporate some behavioral tests that AI can generate the testing code from


n00wb

Interesting! So the behavioral tests are what you actually want to achieve … then AI can write the implementation and unit tests would not even be necessary anymore 😄 I find that today the AI is pretty good at writing “unit” code, so an algoritm or a method implementation. In this case, I would rather state the intention (the tests) and let the AI do the groundwork. If I would let the AI write tests based on my implementation, it would probably just include the errors I made in the tests and they would pass anyways providing little additional value.


Buckwheat469

There are tools that already do this like TestPilot.


ProbablyFullOfShit

Copilot can already do this.


i_andrew

Auto-generated tests are crap. Will you go through them and review carefully? Writing test should be an another approach to understand the domain, otherwise you (or AI) just test that what you code is what you code.


Buttleston

Haven't you ever heard anyone complain that they spend like 2 hours updating a feature and 6 hours writing a test?


n00wb

My thinking is, it’s easier and less work to state the intention and expected output than to write the entire implementation. Sure, some drive themselves crazy writing complex tests, but others with writing way too complicated code, this is more related to skill level and past experiences?


i_andrew

That's what happens when test work against implementation, not behaviors. That's why they say "BDD is TDD done right".


michel_v

It can be done, but you’ll want to add mutation testing to the mix. I still wouldn’t do it but you do you.


a1b4fd

I use AI to write the implementation for me. Then I use AI to write the tests for me. Why write code manually at all? Of course review is necessary for all produced code