News for hackers. Stuff that matters.
Re:62% of code generated by GPT-4 contains API misuses by thomasfromcdnjs on Sunday August 27, 2023 @07:59PM (#37287933)
I've heard this from many people now but I cannot relate at all. Copilot has changed my entire strategy of programming (which I have been doing for 20 years)

It writes lots of code before I even think about what I was going to do in that file. Half the time it just works outright, and if not, with minor changes.

It is fantastic when I have to build functionality in languages I am not great at.

I regularly copy and paste code from my colleagues PR's and paste it into GPT-4, it explains it perfectly and gives tips on how to improve it (which I add as comments to my PR review)

Re:62% of code generated by GPT-4 contains API misuses by redhale on Sunday August 27, 2023 @08:27PM (#37288165)
This!

I wonder if it's a language difference thing (I use C# mostly), but my experience with Copilot has been nothing short of mind-blowing.

It's not writing every line, and when writing truly new feature code it's less useful. But here are two patterns that I've noticed it is especially and consistently good at as a potential place to look for initial value if you are skeptical:

- If you have any kind of repeated pattern, even very complex ones, like performing a set of operations on a set of objects, or initializing a set of things, or whatever, it will guess everything else after the first line 90% of the time. This stuff is almost always plumbing/wiring/boilerplate-type code, so pure time gained. Think about Excel filling incrementing numbers down a column, but for pattern-matched lines or blocks of code.

- For any reasonably testable class, if I write the name of the unit test, Copilot will write the entire unit test perfectly 90% of the time, down to variable names and //Arrange//Act//Assert comments that I stylistically prefer. Seriously, it's sort of scary how good it is at this.

Re:62% of code generated by GPT-4 contains API misuses by toyg on Sunday August 27, 2023 @08:39PM (#37288263)
Languages like C# and Java have always required a lot of boilerplate and repetitive (sorry, "patterned") code. They are perfectly suited to GPTs.
Re:62% of code generated by GPT-4 contains API misuses by justinlloyd on Sunday August 27, 2023 @09:57PM (#37288770)
I've used ChatGPT and Copilot with Javascript & Typescript and a bunch of frameworks. Python, C, C++, C#, Go, 6502, Z80, ARM and a few other languages so far. They've all worked pretty good. I wish it had a wider breadth of APIs and documentation, but it is pretty good so far.
Re:62% of code generated by GPT-4 contains API misuses by hedora on Sunday August 27, 2023 @08:10PM (#37288026)
Meh. My coworkers do what you’re doing, and then I end up rewriting their stuff. (AI generated stuff generally passes code reviews because it gets the benefit of the doubt.)
Re:62% of code generated by GPT-4 contains API misuses by wesleywt on Sunday August 27, 2023 @08:31PM (#37288198)
Meh. I started coding professionally in the age of AI. My productivity is way higher than it should be. I don't let the AI "write" the code for me. I use it as a companion that I asked question of and suggestions.

It suggests solutions to problems, I add the complexity. So far my code has been both clear and performant. This should not be the case at my level.

Re:62% of code generated by GPT-4 contains API misuses by enumjorge on Sunday August 27, 2023 @09:25PM (#37288575)
> I started coding professionally in the age of AI.

What does this mean?

Copilot was released in March of this year. ChatGPT 4, which the community considers to be the only version of ChatGPT to be competent enough at coding tasks, was also released in March.

My guess is that you didn't mean that statement to be a fancy way of saying "I've been coding professionally for around 6 months", but I don't know what else you mean by the "age of AI".

Re:62% of code generated by GPT-4 contains API misuses by anon25783 on Sunday August 27, 2023 @09:44PM (#37288693)
Maybe they think this is LinkedIn? /j
Re:62% of code generated by GPT-4 contains API misuses by FeepingCreature on Monday August 28, 2023 @02:20AM (#37290488)
The community is wrong, ChatGPT 3.5 is fine.
Re:62% of code generated by GPT-4 contains API misuses by Philpax on Monday August 28, 2023 @03:17AM (#37290858)
Minor correction - the original version of GitHub Copilot was released in late-2021.
Re:62% of code generated by GPT-4 contains API misuses by master_crab on Sunday August 27, 2023 @08:08PM (#37288002)
I feel like using suggestions for line by line composition might lend itself to better review by programmers.

As opposed to ChatGPT which spits out dozens of lines of code based on a request and therefore requires more involved editing after the fact to understand what’s happening.

Re:62% of code generated by GPT-4 contains API misuses by wesleywt on Sunday August 27, 2023 @08:32PM (#37288212)
Yes, GPT is an aid not a programmer. You should still be doing the programming while ChatGPT gives you quick solutions to problems without having to look up Stack Overflow.
Re:62% of code generated by GPT-4 contains API misuses by darklycan51 on Sunday August 27, 2023 @09:10PM (#37288492)
copilot? lol

I can understand using chatgpt 4 but copilot??? copilot can barely autocomplete... and half the time it does it incorrectly when variables and other stuff are involved

Re:62% of code generated by GPT-4 contains API misuses by biohax2015 on Sunday August 27, 2023 @09:11PM (#37288497)
Copilot has been incredibly useful for me
Re:62% of code generated by GPT-4 contains API misuses by simonw on Sunday August 27, 2023 @11:55PM (#37289557)
Sounds like you would benefit from spending some time learning how to use Copilot.

Which isn't easy, because there's virtually no documentation for it.

Once you get the hang of it it's incredibly useful. I really feel it when I'm working in an editing environment without it now.

Re:62% of code generated by GPT-4 contains API misuses by enumjorge on Sunday August 27, 2023 @09:18PM (#37288539)
It's comments like these that make me wish I could stand behind the chair of the people who get these results because I feel like there's something lost in translation. I don't know if I'm taking your comment too literally but this part confuses me:

> It writes lots of code before I even think about what I was going to do in that file.

If you haven't even thought of what you want to do in the file, how are you prompting Copilot to write the code you need? Am I understanding correctly that Copilot not only generates the correct code, but it's also able to deduce what code you meant to ask for without any input from you? I don't see how this is possible except in the uncommon case where you are bringing a file to be more in line with other files in your code base that have a similar structure.

I do think Copilot can be useful, but I'm confused at how different my experience is from what others are getting out of the tool.

Re:62% of code generated by GPT-4 contains API misuses by abootstrapper on Sunday August 27, 2023 @09:38PM (#37288657)
ChatGPT 4 is amazing! I use it when I’m blocked to get unstuck. I don’t need perfectly functioning code, just something to get my gears turning. I use it to review my own code. It often has pretty good suggestions, or can validate my approach. And I use it to sketch out unit tests for me. I still have fill in pieces, but it’s absolutely improved my output. It’s like having an egoless programming partner. Yeah, it makes mistakes, but I treat the AI like a programming buddy, not a flawless code wizard. It doesn’t solve problems for me, but we come to solutions together.
Re:62% of code generated by GPT-4 contains API misuses by squeaky-clean on Sunday August 27, 2023 @09:40PM (#37288672)
> Am I understanding correctly that Copilot not only generates the correct code, but it's also able to deduce what code you meant to ask for without any input from you?

You can know what you want to program, but not how you would approach the code. "Hey ChatGPT, how do I draw a curved line plot in JUCE?"

Re:62% of code generated by GPT-4 contains API misuses by thomasfromcdnjs on Sunday August 27, 2023 @10:07PM (#37288833)
What I find useful is I write two lines of comments when starting a new file, about what it is going to do.

Otherwise, even just creating a function, generally they will be filled out automatically.

I suppose I'm quite big on naming (vars and functions)

Maybe if your language or code is more terse, it might struggle more.