News for hackers. Stuff that matters.
Re:GPT-4 is phenomenal at Code by stuff20230314 on Tuesday March 14, 2023 @07:57PM (#35161443)
That's cool and all, but can it do "in this existing code, please amend this feature"? Also useful, "please cover this code with meaningful unit tests"?
Re:GPT-4 is phenomenal at Code by simonw on Tuesday March 14, 2023 @08:01PM (#35161485)
Yes, it can do both of those things.

I've done a bunch of stuff with ChatGPT where I've pasted in code and asked it to make changes. The main limit there is the token limit - 8,000 I think for ChatGPT - so I'm very much looking forward to experimenting with the increased 32,000 limit when that becomes available.

I write tests for my code using Copilot a bunch - sometimes by pasting in the code I want to test and starting to type tests - it autocompletes them really effectively.

I wrote a bit about that here: https://til.simonwillison.net/gpt3/writing-test-with-copilot

Re:GPT-4 is phenomenal at Code by stuff20230314 on Tuesday March 14, 2023 @08:07PM (#35161583)
1. So, current and immediate future limits prevent this beyond relatively small projects?

2. But like, you still have to write tests though? If I need to think and check what the generated tests are doing, I'd rather write them myself to be honest. I want the time-consuming parts automated, not typing code. Maybe I am in minority. Surely generating 99% complete unit tests should be some sweet-spot for ChatGPT? I would imagine this AI can ignore halting problem, and somehow traverse all possible states anyway?

Re:GPT-4 is phenomenal at Code by simonw on Wednesday March 15, 2023 @04:43PM (#35174441)
Absolutely. Using LLM code without reviewing it is an even worse idea than accepting a PR from a brand new apprentice-level programmer at your company without reviewing it.
Re:GPT-4 is phenomenal at Code by coenhyde on Tuesday March 14, 2023 @08:32PM (#35161905)
Probably. GPT3.5 was really good at writing unit tests. I asked it to unit tests for some typescript code using jest and aws-sdk-mock. It did it as I would do. I really couldn't fault it.
Re:GPT-4 is phenomenal at Code by sualehasif on Tuesday March 14, 2023 @08:00PM (#35161477)
Definitely.

For e.g. you cannot say go to VSCode and add this feature. But, If we point it to the piece of code and ask it to append it and write tests, it does really well. (We want engineers to have control haha.)

Re:GPT-4 is phenomenal at Code by stuff20230314 on Tuesday March 14, 2023 @08:09PM (#35161617)
...it does really well... As in "ready to commit" or leaving the hard part (review of correctness) to developer?
Re:GPT-4 is phenomenal at Code by CapstanRoller on Tuesday March 14, 2023 @08:13PM (#35161672)
>Also useful, "please cover this code with meaningful unit tests"?

ChatGPT can already do that, assuming you provide reasonably well-formed specifications as input.

Re:GPT-4 is phenomenal at Code by yieldcrv on Tuesday March 14, 2023 @08:01PM (#35161490)
> Also useful, "please cover this code with meaningful unit tests"?

GPT-3.5 is already really good at that. If you aren't using ChatGPT for your unit tests I'd suspect you're on a Performance Improvement Plan by now

Re:GPT-4 is phenomenal at Code by xur17 on Tuesday March 14, 2023 @08:07PM (#35161593)
What portion of the code do you feed it as an input?
Re:GPT-4 is phenomenal at Code by CapstanRoller on Tuesday March 14, 2023 @08:15PM (#35161694)
You feed it design specifications as input, the same way that a human SDET would do it. The challenge, as always, is to have well-written specification docs.
Re:GPT-4 is phenomenal at Code by stuff20230314 on Tuesday March 14, 2023 @08:13PM (#35161667)
Yeah, I am sure the FAANG devs are all copy-pasting things into ChatGPT or requesting Copilot. Sure.