News for hackers. Stuff that matters.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @07:43AM (#27698153)
The amount of people who think that GitHub Copilot is a good idea is just frightening. Just shows how many people never thought about the semantics of their programs for even a second.

Am I against AI supporting humans? Of course not! I think it's the future and holds almost infinite potential. But the way this is done matters, and this is done just so utterly wrong.

How could it be done properly? Well, let's say you have a system in place where you actually prove the correctness of your program. Then of course there is no harm in letting the AI construct the program, because you know it is correct. Or let's say you wrote the program, and now the AI helps you to prove it is correct. Or both.

Of course, when the correctness of your program does not matter in the first place, but just its output, and you happen to be able to judge the quality of the output without knowing anything about your program, then something like Github Copilot makes sense.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @08:18AM (#27698347)
Unless you never copy/paste from stackoverflow, this argument is kinda moot. Copilot/kite/etc don't intend to replace your brain, it's a shortcur for googling. You are fully expected to understand, adapt and fix the suggestion.

Now I do understand many won't do so. But they already do the same, just slower, with their current method.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by takeda on Thursday July 01, 2021 @01:19PM (#27701642)
I see comments like this and makes me wonder if it's a hyperbole or am I the weird one?

I admit, there few times I copied but I can count on fingers the number of times I used something from stackoverflow in my entire career (I'm not counting situations when I read somebody's explanation, but didn't use their code, which is just an example of how it works). From posts that I see people write as if they do that daily.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by sli on Thursday July 01, 2021 @01:30PM (#27701804)
I've used plenty of knowledge found on SO but I've never done a direct copy/paste. I also find it kind of weird how "normal" copy/pasting from SO seems to be. It's always paid off better in my experience to take the extra minute to understand the code I would have otherwise copy/pasted, and then implement what I need from it myself. The time savings from copy/pasting seem to average back out later as technical debt when something inevitably has to be fixed or changed.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by fierro on Thursday July 01, 2021 @01:49PM (#27702085)
I mean sometimes you need the exact code described in a SO post, even if it's one line. So you either look at the screen and manually retype it, or copy and paste.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @03:34PM (#27703511)
copy/paste doesn't imply avoiding to read, understand and modify the code. What with all those false dichotomies?

Also SO is only an example. There are many sites, and I call BS anybody who doesn't Ctrl + C once in a while, be it from the docs.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by nitrogen on Thursday July 01, 2021 @01:30PM (#27701811)
Copy/pasting does not lead to understanding. The understanding I gain from not copy/pasting allows me to pursue more difficult projects where there isn't a ready-made answer online. If you want to grow, you have to do the work yourself.

And if you want others to grow, make sure your answers give knowledge without giving solutions.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dalmo3 on Thursday July 01, 2021 @06:15PM (#27705556)
I find it very weird too. I copy and paste a lot from documentation, or GitHub issues, but generally SO questions are very idiosyncratic.

Maybe it's the language you work with?

If I copy and paste React code from SO it'll 100% break my app due to incompatible abstractions, so it doesn't make any sense to do it. However if I need a complex generic Typescript utility type, copying things verbatim is usually fine.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by Teknoman117 on Thursday July 01, 2021 @02:54PM (#27702970)
I wish it was hyperbole, but looking at some people I know I know it to be true.

I've never had the luxury, I mostly work on low level stuff and at best, SO is usually only helpful in pointing me in the right direction.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by neolog on Thursday July 01, 2021 @02:14PM (#27702416)
Perhaps you learned to program before StackOverflow existed.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @04:24PM (#27704300)
So did I. In fact, I own one of the first SO accounts and have a top 100 all time reputation score.

And still I copy paste.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by lucideer on Thursday July 01, 2021 @09:45AM (#27698976)
Copy/paste from stackoverflow is a great analogy: Copilot is making something that already has a huge negative* impact on code quality more optimised and easier to do as part of your daily coding flow.

* Just to clarify, I'm not saying SO is bad, but just specifically the practice of blind copy/paste without reasoning about & understanding the code you've copied. SO moderators encourage/semi-enforce descriptive answers for this reason; to add context to the solutions provided.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by _vertigo on Thursday July 01, 2021 @10:15AM (#27699244)
I think on the whole, stackoverflow has vastly improved overall global code quality.

Even if you just limit it to people largely taking solutions wholesale from SO, I still think that it’s a good jumping off point. Of course it’s a mistake to not make any modifications or look deeper than the whatever is in the snippet, but the snippet is often much better than what a noob would come up with.

Also, it’s an opportunity for learning new patterns that you might not have come up with yourself.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by lucideer on Thursday July 01, 2021 @10:28AM (#27699370)
> Even if you just limit it to people largely taking solutions wholesale from SO, I still think that it’s a good [...]

I would respectfully disagree on this point. Anything that perpetuates doing this in any way will always have a negative impact on code quality. If an engineer is copying solutions wholesale, even if those solutions are robust and high-quality, that's an indicator of the approach they have to producing code on a daily basis, which is going to have a much larger overall impact than that 1 answer on SO.

SO is imo a net positive benefit to the community, but only by virtue of them doing other beneficial things that balance out with the harm of copypaste programming. But I don't buy that copypaste programming is benign.

> Also, it’s an opportunity for learning new patterns that you might not have come up with yourself.

Blind copypaste is by definition not an opportunity to learn, because you need to understand (hack/fork/adapt answers given) to learn from them.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @11:07AM (#27699803)
Why do everybody keep repeating "blind" everywhere? Like it's a curse that can't be avoided.

Also why all the anti-copilot seems to think their code is great, or even well understood by themself.

I have counterexamples everywhere around me all the time for these 3 points.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by lucideer on Thursday July 01, 2021 @11:19AM (#27699980)
> Why do everybody keep repeating "blind" everywhere?

"Blind copypaste" is just slightly more specific thing than just "copypaste". Copypasting code you fully understand and trust is fine (though in practice, is the rarer case). "Blind copypaste" implies you know it works(ish?) and don't care as much about the how.

> Also why all the anti-copilot seems to think their code is great, or even well understood by themself.

My code is certainly not great, but I like to think I understand what I've written pretty well (there are many contributors to poor quality code, not understanding what you're writing is just one potential one).

I also like to think that, while it's not great, it's on average going to be better than code put together by someone who doesn't fully understand what they've written.

> I have counterexamples everywhere around me all the time for these 3 points.

Do you? By what metric do you consider them counterexamples?

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tynpeddler on Thursday July 01, 2021 @12:28PM (#27700909)
> But I don't buy that copypaste programming is benign.

Copypaste programming doesn't have to be benign in order to be better than the likely alternatives. The people who blind copy/paste are likely not producing high quality code in the first place. In which case, blind copy/paste is often an improvement.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by jandrese on Thursday July 01, 2021 @02:37PM (#27702733)
I think of StackOverflow as basically crowdsourced documentation. In a perfect world the documentation that comes with your tools would be complete, correct, and readable. Unfortunately in our world this is often not the case and people end up having to do one of three things:

1. Delve into the original source to see what happens (or reverse engineer the binary) -- very time consuming!

2. Guess. Maybe write some test apps to play around with it till you get it working. This used to be very common, but leads to situations like the PS2 encryption algorithm being completely broken because the devs didn't understand the IV parameter.[1]

3. Go on StackExchange and find an example of what you are trying to do, usually with some helpful discussion about the parameters.

[1] You would think security libraries would have the best documentation because it's so important to get it right and difficult for the developer to detect mistakes, but I've found the opposite to be the case. They're some of the worst offenders for just showing you a cryptic function prototype and assuming you know everything about the underlying math already. It feels like the crypto guys think if you couldn't write your own crypto library then you aren't good enough to use theirs, kind of missing the point of libraries.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @10:45AM (#27699533)
Blind is the keyword here
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tyingq on Thursday July 01, 2021 @08:21AM (#27698365)
Stackoverflow at least has the benefit of whatever comments might be around it. As far as I can tell, the copilot suggestion doesn't have any way to rate it, make a comment, flag it, etc.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by squeaky-clean on Thursday July 01, 2021 @01:58PM (#27702216)
Agreed. How many times have you seen the "accepted" answer on a Stackoverflow be suboptimal if not outright wrong, and a much better answer is lower down the page. For me it feels like 50% of the time or more.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by jfoster on Thursday July 01, 2021 @09:08AM (#27698708)
I think they kind of do. On the Telemetry section of the Copilot site, they mention that they relay whether a suggestion was accepted or rejected.

I wonder, how much better could Github Copilot become by also looking that the modifications that are subsequently made to the accepted suggestions? Obviously this would go quite a bit further in terms of telemetry, and may become an issue. They would essentially be training based on non-public code at that point.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tyingq on Thursday July 01, 2021 @09:10AM (#27698720)
I guess that's a start, but I think comments, flagging, would have value. There's lots of reasons you might not accept something.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by ffhhj on Thursday July 01, 2021 @09:34AM (#27698871)
> On the Telemetry section of the Copilot site, they mention that they relay whether a suggestion was accepted or rejected.

That will make it the target of a collaborative bias attack.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by naniwaduni on Thursday July 01, 2021 @09:35AM (#27698887)
Wait, are we sure it'd need to be collaborative?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by ratherbefuddled on Thursday July 01, 2021 @09:36AM (#27698895)
I'm guessing but surely it reads the code you end up with and uses that to train?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by e_proxus on Thursday July 01, 2021 @09:42AM (#27698953)
So it will be self-reinforced to get worse and rot over time? Since surely all code that used Copilot will be slightly worse than code without (extrapolated on the assumption that Copilot is wrong some of the time).
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by vincnetas on Thursday July 01, 2021 @08:23AM (#27698384)
Let's agree that copy/paste from stack overflow is bad, and don't use "but people are already doing this" to justify copilot approach.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tailspin2019 on Thursday July 01, 2021 @09:28AM (#27698825)
> Let's agree that copy/paste from stack overflow is bad

I think context is important. It's not inherently bad. If you are inexperienced or don't know what the code/command is doing then yes that's not ideal.

But competent developers using Stack Overflow (and all other external memory devices) appropriately to aid their workflow is perfectly valid.

I rarely copy/paste verbatim from Stack Overflow (apart from perhaps bash commands where the answer is literally the exact command I need - and in that case, why would I not use it?). But I do copy/paste, as long as I understand the code, and then adjust it accordingly.

In my experience of coaching junior devs. The number one skill I've had to train them in, above all else, is the ability to efficiently search for and find answers to their questions/unknowns quickly. (As well as digest those answers and incorporate the knowledge into their understanding - not just blind copy/paste).

I'd go as far as to say that If you are a developer in 2021 and not constantly looking up things for reference (whether to jog your memory or to quickly learn new concepts) then you're either a genius with a photographic memory, working in a very constrained domain that isn't stretching you or you're just plain doing it wrong. :-)

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @08:39AM (#27698509)
I don't agree. I use it all the time. I just don't do it blindly.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by addicted on Thursday July 01, 2021 @09:44AM (#27698967)
I'll add that with SO it's always helpful to read a few answers below the accepted ones.

There's always almost some nuance that the accepted answer might be lacking or you should know about that is mentioned.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by midev on Thursday July 01, 2021 @01:47PM (#27702044)
Sometimes I do it blindly too! I don't always care about the "how". Sometimes I'm just looking for a single line to convert a data type, or a bash command to do something. Not interested in learning all the arguments to various bash tools. I just want to delete some files and move on.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by YetAnotherNick on Thursday July 01, 2021 @08:31AM (#27698452)
> don't use "but people are already doing this" to justify copilot approach.

Why not? Most of the software is not built by checking the formal verification of specification but by looking into the code and having reasonable understanding that it works. Also there will be errors in the code whether we use copilot or not. Personally if I don't have an option to do a build and run and look into the output, I am reasonably sure that there is at least one bug in something like every 50 lines.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by majormajor on Thursday July 01, 2021 @02:38PM (#27702747)
It's very simple: googling and copying should be a method of last resort. Behind even "googling and learning and then writing your own code based on what you learned," for instance. I'd bet I do it less than once a week. (Trying to find something through google and FAILING to find a useful answer is, sadly, much more common for me.)

Copilot makes it a method of FIRST resort.

If I know what I'm doing, and know I should escape my inputs... but copilot barfs up a block copied from someone who didn't... now I have to retrain myself to spend time reading the suggested code for stupid shit like that versus just using my own knowledge in the first place.

That's a far cry from "i know the method name I want has 'string' in it somewhere"-style autocomplete.

You're basically importing a library of "every stupid crap anyone committed to github" and just hoping the the library functions in it are safe and reasonable. That's a crazy dependency to bring into your project if your own programming skills are above that of the median github user.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by aeorgnoieang on Thursday July 01, 2021 @04:23PM (#27704275)
> That's a crazy dependency to bring into your project if your own programming skills are above that of the median github user.

So, roughly half of programmers would be _better_ served just blindly using Copilot's suggestions then?

Personally, I find that I work with so many different things so often that I "googling" is often much quicker even than reading documentation or even searching my own existing code.

But I also have _zero_ interest in Copilot at all, so what do I know?

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dariusj18 on Thursday July 01, 2021 @08:48AM (#27698564)
I'm not sure I've ever copied code from StackOverflow, though I do use it for inspiration.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @08:52AM (#27698588)
Not even a command line ?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dariusj18 on Thursday July 01, 2021 @08:54AM (#27698606)
Oh no, definitely not. If I don't understand what it is doing then I don't put in in my command line. That's a recipe for disaster.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by AlexAndScripts on Thursday July 01, 2021 @09:01AM (#27698650)
What if you now understand what it's doing (jogged your memory) and its a long command?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by marcosdumay on Thursday July 01, 2021 @12:09PM (#27700644)
Then you take the lessons you need from the line and encode them in a properly formatted script.

A long command is almost never a good answer.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dariusj18 on Thursday July 01, 2021 @09:06AM (#27698691)
Very rarely does a command line example map one to one with what I want to accomplish anyway. But also, I can't think of any "long" commands that I would need.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @09:00AM (#27698643)
why would you not understand it ? it seems unrelated.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by corobo on Thursday July 01, 2021 @08:57AM (#27698626)
Type it out anyway, copy paste security risks or not, it helps you remember how to do it in future
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by rndgermandude on Thursday July 01, 2021 @10:57AM (#27699661)
I honestly never copy-paste from StackOverflow. I go there for general pointers or look at the code snippets and will only use what I think I figured out, and then write code myself.

Even that cannot really protect me from missing things like the security implications that this blog post talks about.

In this case, I probably wouldn't have fallen for the stuff CoPilot (or an equivalent SO answer) suggested, as I learned about these kind of injection issues a long time ago, but there are certainly a lot of areas where I would fail miserably to detect subtle (security) bugs. APIs are full of subtle and often non-obvious pitfalls, and even algorithms can be, where the algorithm seemingly works except for non-obvious edge cases that you might not have considered.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by gnulinux on Thursday July 01, 2021 @01:44PM (#27702002)
> Unless you never copy/paste from stackoverflow

Is this serious? I've never literally copy pasted from stackoverflow. I read the answer and then go write my own code. Did you seriously copy pasted an entire chunk of code and committed it to your codebase after some edits?

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Friday July 02, 2021 @01:18AM (#27708034)
If you identify it's the right code, why not ?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by gnulinux on Friday July 02, 2021 @01:44PM (#27714496)
If it's exactly what I want, then I'd be ok. It's just that, that never happened to me. The closest I came was, I was checking a regex and realized I missed some cases, so I copy pasted the regex string from SO. I can't imagine a scenario where a >1 line code in SO can be exactly what my codebase requires. Regardless, my methodology isn't going to SO to find code, I go to SO to read the answers, understand then write code. I never thought when people talk about "copy paste from SO" they literally mean like copy someone's code and paste it to your text editor.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by hintymad on Thursday July 01, 2021 @02:00PM (#27702237)
A difference between auto-completed code and stackoverflow answers is that the latter comes with explanations and comments, which help us understand the internals of offered answers.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by bcrosby95 on Thursday July 01, 2021 @11:46AM (#27700343)
How often do people literally copy/paste from stackoverflow? Because that is what copilot is doing. It's literally pasting in the code for you.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by skohan on Thursday July 01, 2021 @11:44AM (#27700322)
I think the main issue is that many people may not use it that way. When copying from stack overflow, there is some minimum understanding required to adapt the code snippet to match your use of types, variable names etc. With Copilot, there's a high chance you will be able to just accept the autocomplete, and then compile your code.

A tool like this has the potential to help good programmers work more quickly, but it carries the risk of acting as a crutch. A lot of people might never put in the work to become good programmers because they learn how to be just good enough at using Copilot to fake it.

In a world where there are lots and lots of people trying to gain entry in the software industry, there's a major risk of this leading to a lot of incorrect, and even dangerous code making it into production because nobody really had a look at it.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by gorjusborg on Thursday July 01, 2021 @02:21PM (#27702512)
I agree the behavior is similar between copilot and copy/pasting the most popular solution from stackoverflow.

However, you seem to be making the argument that is good behavior. I say it is not. The time saved by automating the googling/copying/pasting is miniscule compared to actually understanding the context in which the code is suited and ill suited. That is the developer's work, and it isn't fed by only the code.

Developing ain't typing. It's solving problems. Most of the time the problem isn't in code. Even when it is in code, there's nuance in how to best solve it that isn't. The idea that AI is useful in understanding the real world context of the problem better than the human (who has the whole context, in code and outside of it) is naive, or disingenuous.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by bogota on Thursday July 01, 2021 @02:38PM (#27702752)
I don’t understand. I never have copy pasted from SO after my first few years of work. At that point you normally are already using libs that take care of most things you would copy paste and are hopefully working ok things more complex than just piecing together sporadic SO posts.

The code i produced during my first few years isn’t something anyone should aspire to.

Additionally you likely learned over time that most SO posts are not great but provide a good starting point.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by darkwater on Thursday July 01, 2021 @11:51AM (#27700418)
> But they already do the same, just slower, with their current method.

I think that when $PROJECT lets everybody do something at a scale that was before impossible, even if it's the "same thing", it is not "the same thing".

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by BiteCode_dev on Thursday July 01, 2021 @12:02PM (#27700559)
There is truth in that, people will be tempted more to (mis)use it, because of the lower friction.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by fouronnes3 on Thursday July 01, 2021 @08:05AM (#27698270)
It's interesting to me that the next few steps of this technology evolution might be that we loose the ability to prove our code correctness forever. Every program will just be a certain - measured by tests - percentage of accuracy against some goal and that's it.

Then when every program is eventually upgraded to this status, all of the code we run is bootstrapped through proprietary AI - including the AI itself - and it's black boxes all the way down. Programming is now an experimental science where we gather evidence, test hypotheses, press the "copilot" button and tune parameters, like evolutionary biologists studying DNA code.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:18AM (#27698343)
Can't say we've really figured out proofs for program correctness now, can we?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @08:33AM (#27698469)
We have figured it out. People with a PhD and given enough time can do it. Scaling this will be possible, especially with the help of AI, as soon as there is the actual will there to do it.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by planb on Thursday July 01, 2021 @09:02AM (#27698666)
We haven't even figured out how to specify what "correctness" means for all but the most trivial examples. What is the "correct" behavior of that example snippet in the linked post?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by WanderPanda on Thursday July 01, 2021 @09:26AM (#27698818)
I don't know anything about formal correctness proofs but my imagination tells me it is bounded by the description of the task. Aren't we just shifting the bugs toward the task description? Or is it about being able to specify a task with a very simple program (e.g. brute force) that is unfeasible to run but can be somehow used to verify that simpler (in terms of runtime complexity) programs provide the same outputs?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pbronez on Thursday July 01, 2021 @09:37AM (#27698903)
Yes. Figuring out what a program SHOULD do is often as hard as figuring out how to actually do it. The relative difficulty shifts depending how far you are from the real world. The closer your project is to actual people doing actual work, the harder it is to define the requirements precisely.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dgb23 on Thursday July 01, 2021 @10:05AM (#27699150)
Yes, they can only logically deduce correctness based on our assumptions of a given system boundary. But I think it is typically a good idea to write them down formally if you need the guarantees. They are also typically smaller and more declarative.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by ImprobableTruth on Thursday July 01, 2021 @09:53AM (#27699055)
Sure, if your task description/specification is buggy nothing can save you, but if you only have to check the spec your work gets much easier. If you write a program, you have to both make sure that the spec is correct and that the spec is correctly implemented.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @09:09AM (#27698716)
Very good question! Try to figure it out yourself and you will see what is wrong with software development today.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IncRnd on Thursday July 01, 2021 @08:49AM (#27698568)
So, for people to quickly implement http requests, we need a mountain of AI hardware backed by legions of PhDs with endless time to vet the http requests.

That doesn't seem sustainable. It also seems like a poor cost to value ratio.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @08:55AM (#27698609)
No. If it is something that has been done plenty of times before, then we would also know how to prove the correctness of it automatically. It would also lead to much better and less code, because you would be aware that it has been done before so many times.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by justanotherguy0 on Thursday July 01, 2021 @09:42AM (#27698952)
So, for people to quickly implement http requests, we need to feed, clothe, and discipline humans for a minimum of two decades, backed by legions of teachers, doctors, and professors with endless time to service them.

That doesn't seem sustainable. It also seems like a poor cost to value ratio

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by j16sdiz on Thursday July 01, 2021 @08:55AM (#27698613)
Proofing correctness (in general) is incomputible (halting problem and stuffs).

Those "prove" you see in academic paper are very specific case.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by ImprobableTruth on Thursday July 01, 2021 @10:00AM (#27699116)
Thankfully correctness in the general case doesn't matter in reality, in the same way that it doesn't matter that not all 'correct' programs can be possibly typed.

And I don't know why you put "prove" in scare quotes. There is formally verified software that has been proven to conform to a spec. They aren't just toy programs either, see SEL4 or CompCert for 'real' programs.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by Tainnor on Thursday July 01, 2021 @11:47AM (#27700358)
The halting problem doesn't prevent you from writing proofs for programs, same as Gödel's theorems don't prevent mathematical proofs from existing.

Fully verified programs do exist (e.g. CompCert C compiler), although for various reasons, it's still a niche.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by JadeNB on Thursday July 01, 2021 @09:07AM (#27698705)
> Proofing correctness (in general) is incomputible (halting problem and stuffs).

> Those "prove" you see in academic paper are very specific case.

Not to put too fine a point on it, but every program written is a very specific case, so I'm not sure this is such a convincing point.

As you say, there is absolutely, provably, no general-purpose algorithm out there that will prove program correctness automatically. That is in no way to say that humans can't or shouldn't try to prove some programs correct, or even that you can't have an algorithm that will prove certain classes of programs correct.

With that said, I do also think your parent:

> We have figured it out. People with a PhD and given enough time can do it. Scaling this will be possible, especially with the help of AI, as soon as there is the actual will there to do it.

is too optimistic, and throwing a little cold water on that rosy prediction is appropriate.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:48AM (#27698560)
I admire your optimism.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by SkyBelow on Thursday July 01, 2021 @09:01AM (#27698652)
>It's interesting to me that the next few steps of this technology evolution might be that we loose the ability to prove our code correctness forever. Every program will just be a certain - measured by tests - percentage of accuracy against some goal and that's it.

Aren't we already there outside of very specific special applications? At the very least you have to assume every library you are using and the framework you are running on is correct. Sure, that works 99.9% of the time. If your testing framework can get the rest of the code to 99.5% of the time, is the .4% that large of a deal in a case where the other .1% is not?

When we look at what the market wants, what individual people want, do they want things proven correct given the increase in cost it brings? They may say they do, but spending behavior doesn't seem to align.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by rdedev on Thursday July 01, 2021 @08:22AM (#27698377)
All programming though ? That's a stretch. Like I'm pretty sure there are domains where correctness of programs is paramount
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by worble on Thursday July 01, 2021 @08:24AM (#27698396)
Is there a domain where correctness is not paramount?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dxbydt on Thursday July 01, 2021 @10:23AM (#27699331)
>is there a domain where correctness is not paramount ?

pretty much every domain, if you exclude finance & industries that intersect with life and death decisions such as pharma/medicine/airlines/defense.

what’s the correct order of movie recommendation ? its easy to see that given your past netflix history, there is an obviously incorrect order. but there is no obviously correct order - any number of orderings will work. correctness is not paramount.

what’s the correct puzzle to assign to a 1400 on chess.com ? obviously there are hundreds of them that would work. correctness is not paramount.

what’s the “correct price” of a used Ford Focus ? depends on whether you are a bandit who needs the car for a rapid getaway, or whether you are the brother in law of the used car salesman, in which case the correct price is zero usd.

the sole reason why 100 million developers crowd the web programming circuit and not other gatekeeped domains is because correctness is not paramount. whether your color code is off by a shade on this browser or your pixels misaligned on that browser, its all fine so long as it somewhat works. correctness is not paramount. otherwise nothing would ship.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by MauranKilom on Thursday July 01, 2021 @08:39AM (#27698508)
Computer graphics maybe? You can shift goal posts what "correctness" means, but if a game renders something in a funny way, it's really not going to hurt anyone. Yes, if it's constantly a total mess nobody will want to play the game, but 1. that would be (presumably) found quickly during testing, and 2. this is a very gradual tradeoff. Nowhere near "paramount".
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by simonh on Thursday July 01, 2021 @08:41AM (#27698520)
Yes absolutely. Take games for example, bugs are absolutely tolerable and to be expected. In fact most software of any kind has known bugs that are simply accepted because the cost to fix them exceeds the value of doing so.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by carlhjerpe on Thursday July 01, 2021 @08:36AM (#27698485)
If people don't die from your mistakes they're not important IMO.

Note that people die if data is lost, causing companies to go bankrupt (suecide). But really, not everything has to be correct, look at Intel and AMD. They've been compromising correctness for speed for quite awhile, and we're mostly fine.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by bamboozled on Thursday July 01, 2021 @09:03AM (#27698668)
Yeah because losing money, market share or people’s data is fine ?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by carlhjerpe on Thursday July 01, 2021 @09:08AM (#27698714)
Depends on the numbers, if my company loses 10k because i made a mistake nobody would "care". Mistakes happen to the best of us, which is obviuous looking at public CVE's. If it's 100k it'd be a different story, considering we're not that big (35 employees). It's just money, it can be replaced, human lives can't.

EDIT: I assume from your comment that you formally verify every line of code in every system you depend on, and run RISC-V to make sure the hardware doesn't tamper with your instructions.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by SkyBelow on Thursday July 01, 2021 @09:02AM (#27698665)
Any domain where the code will be used by a consumer who will go with a mostly correct program that has a fraction of the cost over one proven correct.

I suspect this to be the majority of code written.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @08:14AM (#27698327)
Yes, this is where this style of thinking leads to. Hard work is required so that we do not end up there. Can this race be won? I hope so.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IMTDb on Thursday July 01, 2021 @08:02AM (#27698253)
It's called "Copilot" for a reason: you are still in the driver seat, and the tool is just there to give you better hints and direction.

I would agree with you if it was called "GitHub Self-Coding" where you are the destination clerk and letting the tool code. But that's really not the goal of the tool. Don't put it in hand of non programmers

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @08:13AM (#27698320)
A real copilot will get fired and/or go to jail and/or die, if it feeds you subtly wrong data, and leads you to crash a plane. GitHub won't suffer any consequences if its Copilot feeds you bad code that causes a security breach, or wastes a lot of engineering time on debugging subtle heisenbugs.

The problem with Copilot is that it works just enough to be dangerous: it streamlines copy-pasting of unchecked code, but the code it offers has subtle bugs. It's even worse than copy-pasting from StackOverflow, because code on SO got at least a passing review by someone who understands it. Here, you get code generated from ML models. Unlike generating pictures of faces or kittens, when an occasional artifact doesn't matter much, an "artifact" in code that you won't notice will still make the code wrong.

> Don't put it in hand of non programmers

Putting it in hands of programmers isn't really any better. To make it work, you need programmers to be disciplined - more disciplined than they were when copy-pasting from SO.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dathinab on Thursday July 01, 2021 @08:19AM (#27698351)
> It's even worse than copy-pasting from StackOverflow, because code on SO got at least a passing review by someone who understands it.

It's like copying from StackOverflow while ignoring upvotes, comments, and anything but the first revision ;=)

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:17AM (#27698338)
If you're taking the code suggestions without reading them it's your fault.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @08:25AM (#27698403)
Discipline doesn't scale.

Also the problem isn't code that's obviously wrong when you read it. The problem is when code looks OK, but is subtly wrong. Which keeps happening - as we know today, at least two examples featured on Copilot homepage have this problem. To make this work, you have to read each snippet super carefully - which defeats the whole point.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:29AM (#27698434)
I really don't think it does defeat the point. The point isn't just churning stuff out as fast as possible without concerning yourself with quality. There are lots of other reasons you'd benefit from snippets -- rote work done for you, familiarity with language ecosystem, and so on.

It's all well and good to say there should be something better than just discipline but there's no idiot-proof way of writing programs.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @08:48AM (#27698565)
Ok, maybe it doesn't defeat the whole point. The way I see it, there are two ways of using Copilot:

1. As a way to specify a problem and get a suggested solution (or a selection of them), to use as a starting point.

2. As a way to specify a problem, get it solved by the AI, and consider it done.

I'd expect that any developer worth their salt will do 1. I expect that of myself. I also worry this is so streamlined that people, including myself, will naturally shift to doing 2 over time.

This is similar to the problem with self driving cars - you can't incrementally approach perfection, you have to get it right in one go, because the space between "not working" and "better than human in every way" is where self-driving is more dangerous than not having it. When it works most of the time, it lulls you into a false sense of security, and then when it fails, you aren't prepared and you die. Similarly, Copilot seems to be working well enough to make you think the code is OK, but it turns out the code is often buggy in a subtle way.

> familiarity with language ecosystem

This is an interesting angle to explore the topic. Familiarity is a big factor when inspecting such generative snippets. For example, I'm really familiar with modern C++, and I'm confident I could spot problems in Copilot output (if and when it starts producing C++), maybe 50% of the time. If it's a logic issue, or initialization issue, I'll spot it for sure. If it's a misuse of some tricky bits of the Standard Library? I might not. I make enough of those mistakes on my own. Or, I know enough JS to be dangerous, but I don't consider myself fluent. I'm definitely going to miss most of the subtle bugs there.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:53AM (#27698599)
To my mind the difference between copilot and semi-autonomous cars is that split-second decisions are not required in this instance. If it takes you a minute to snap out of it and notice the suggestion was wrong, no problem.

On your other point, it's true that if you're working in an unfamiliar ecosystem, spotting subtle issues will be harder. But I think getting automatic suggestions that are probably idiomatic in that language will be more helpful than hurtful.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by aeorgnoieang on Thursday July 01, 2021 @04:29PM (#27704357)
> When it works most of the time, it lulls you into a false sense of security, and then when it fails, you aren't prepared and you die.

That still doesn't _necessarily_ imply that 'partially self-driving cars' are worse than actually existing humans. Really, anything that's (statistically) better than humans is better, right?

I don't think it's reasonable to think that even 'perfect' self-driving cars would result in literally zero accidents (or even fatalities).

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by simonh on Thursday July 01, 2021 @08:32AM (#27698460)
If you already knew how to do the thing, then you wouldn't need co-pilot. The whole purpose of this tool is to suggest a way to do the thing, and the biggest value is when you don't know how to do it and need help. In that case, if you can't trust the help what use is it?

As others have pointed out, at last Stack Overflow comes with context, the ability to rate and comment on suggestions, or even have a discussion about an approach. With this you take it or leave it. Saying you should already know what you need to do and what the tradeoffs are and how to evaluate the quality of the suggestion is basically saying this should have no value to you, and any consequences are all your fault if it does.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by corobo on Thursday July 01, 2021 @09:16AM (#27698746)
I only ever picture myself using it to speed up side projects to be honest. It is a glorified tab complete. A quite glorious one don't get me wrong, but that's all it is.

If you're using it to create something you don't know how to do then yeah you're in for a world of disappointment.

HN seems to be of the hivemind that random Joe Nocodes will be firing up VSCode and asking it for a custom version of Uber which.. yeah is laughable and honestly seems pretty obvious that that wont work.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by marcosdumay on Thursday July 01, 2021 @12:18PM (#27700774)
> It is a glorified tab complete.

Interesting metaphor. Notice how the Bash tab completion is a great tool, that increases people's productivity by a large amount, and receives only complements from anybody you ask. At the same time, the newish Windows cmd tab completion is a great productivity destroyer that gets mostly only criticism and you will find way too many people blaming it for losing data.

Do you know what is the difference? The bash tab completion is always correct. If it can't be correct, it gives you as much of a correct answer as it can, and leaves the rest up to you. The cmd tab completion doesn't care at all about being correct, it will always give an answer, no matter what you ask for.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @03:14PM (#27703258)
Lots of people on Unix systems prefer the much more permissive guessing zsh offers.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by marcosdumay on Friday July 02, 2021 @05:57PM (#27717431)
Hum... I can see how people would like zsh. It doesn't just guess at the first tab press, and that extension that displays all the alternatives before looping is nice. It's permissive but it's disastrous interaction is opt-in.

If autocomplete on IDEs were that respectful, I'd like them too.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by corobo on Friday July 02, 2021 @01:59PM (#27714661)
I use zsh as the sibling mentioned to be honest. Giving me options is the best option
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:49AM (#27698573)
I think there's a pretty wide continuum of "knowing how to do it" and in a lot of cases you have a pretty good idea what's going on by seeing the code, once it is presented. I'd further suggest that a lot of examples the give on the page are just finishing tedious series where the problem is mostly just typing it all out.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by aeorgnoieang on Thursday July 01, 2021 @04:31PM (#27704388)
Even when I _do_ know "how to do the thing", I've learned, thru painful (and repeated) experience, that I can't trust myself!

(But I also have no interesting in using Copilot myself, tho maybe I should try it myself now, if only on some toy side project.)

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by londons_explore on Thursday July 01, 2021 @08:18AM (#27698344)
We could call it "Full Self Coding (BETA)", which is an addon package costing $10k, but with a promise that it'll just get more valuable over time. Eventually, you'll be able to rent out your Full Self Coder and get a full coder salary while you sit on the couch at home doing nothing!
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by carlhjerpe on Thursday July 01, 2021 @08:31AM (#27698456)
Then GH will realise that their product will never be able to do Full Self Coding in it's current form (need to install a supercomputer (LIDAR) at home to do this safely in any language other than rust). This will require that you buy Github Copilot SFC Model Z, It'll be released next year once they've gathered data from your coding habits for awhile. Pinky promise
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tyingq on Thursday July 01, 2021 @08:08AM (#27698289)
Perhaps pedantic, but "copilot" in the real world implies something very different from hints and direction.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by zozbot234 on Thursday July 01, 2021 @08:13AM (#27698323)
So you're saying Copilot is the new Autopilot.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pjerem on Thursday July 01, 2021 @08:29AM (#27698435)
No, copilot in the real world is not the pilot's assistant, it's also a pilot, do the same work as the pilot, takes the commands as much as the pilot and can or cannot be more experienced than the pilot.

In fact, the copilot is just a normal pilot with the only difference that the pilot is also the captain on board, responsible for the police and security on board. And most of the times, companies choose who is the pilot and who is the copilot randomly on a per-flight basis.

So no, you wouldn't a copilot that gives subtly wrong information to the pilot (and vice versa)

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by jaywalk on Thursday July 01, 2021 @11:24AM (#27700071)
> And most of the times, companies choose who is the pilot and who is the copilot randomly on a per-flight basis.

What companies are you aware of that do this? The proper terms are "Captain" and "First Officer" and they are actual rankings within the company, not something that is randomly chosen on a flight-by-flight basis. The actual details of who does what during the flight are generally not related to the ranks ("pilot flying" and "pilot monitoring" duties can and do switch during flight) although the Captain is always the ultimate authority and will be the one to take control in tough situations because he's got more experience.

Typical (i.e. almost all) commercial flights will have a Captain sitting in the left seat and a First Officer sitting in the right seat.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pjerem on Thursday July 01, 2021 @01:42PM (#27701980)
I think i was plain just wrong on the "random" part. Mea culpa, I apologize.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by falcolas on Thursday July 01, 2021 @09:34AM (#27698877)
Tesla Autopilot, absolutely.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by d_theorist on Thursday July 01, 2021 @08:32AM (#27698463)
Exactly. Copilots are fully-capable pilots who frequently take full control of the plane. It's not an appropriate analogy at all.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by skohan on Thursday July 01, 2021 @11:48AM (#27700371)
> Don't put it in hand of non programmers

Who's going to stop them? There's an army of non-programmers trying to break into the industry. You can bet they are going to get their hands on this.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by arcturus17 on Thursday July 01, 2021 @07:58AM (#27698221)
I'm afraid I don't understand your argument. The programmer is still ultimately responsible for the correctness, and quality, of the program. These are just very advanced IDE hints.

How is this approach "wrong"?

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dathinab on Thursday July 01, 2021 @08:25AM (#27698401)
Sadly (?) there are many not so good programmers (e.g. because they are new to it).

Finding a bug in something which seems to be correct can be harder then writing the correct code yourself.

Especially if you might not (yet) fully understand what you are doing.

So Copilot is only a good idea if you are a experienced programmer with the discipline to put any auto generate part through a proper (ad-hoc) code review.

At the same time it looks especially appealing to someone just starting to learn coding...

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IshKebab on Thursday July 01, 2021 @09:55AM (#27699073)
Right but that all applies to any situation where you use someone else's code. Reading Stackoverflow answers. Blog posts. Even other code on Github.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by aembleton on Thursday July 01, 2021 @08:37AM (#27698491)
Then it can be picked up in a code review.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @08:52AM (#27698587)
Spotting bugs in code review is already hard when the code you're reviewing has been written by a human. In this case, at least you can rely on your knowledge of the co-worker who wrote it - over time, you learn the kind of experience they have, the kind of mistakes they make.

Spotting bugs in code that has been generated by a GPT-3 derivative, with all the subtle mistakes that implies, is going to be even harder.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by stackbutterflow on Thursday July 01, 2021 @10:40AM (#27699468)
In the end we need to tag each piece of code written by copilot. Doing a code review on a piece of code written by a human and on another one generated by copilot is going to be a very different experience. I would be way more wary of a PR containing copilot generated code. Turns out copilot will be a productivity killer.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by aeorgnoieang on Thursday July 01, 2021 @04:34PM (#27704428)
> Spotting bugs in code that has been generated by a GPT-3 derivative, with all the subtle mistakes that implies, is going to be even harder.

I'm kind of skeptical! I think your claim is reasonable tho so maybe I'm more skeptical of your confidence?

I'd love to read a follow-up from you after you tried using Copilot for an extended period; even (or maybe especially) if it's as bad, or worse, than you expect!

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pyrale on Thursday July 01, 2021 @09:04AM (#27698678)
But good code reviews are much harder at scale than building good code in the first place. The reason we write code _and_ do code reviews is because doing both is better than doing either.

But copilot isn't even equivalent to a code review: code review is not only checking for correctness. It's also asking questions and helping the author walk through their solution by having them reconsider it. Copilot doesn't ask questions, nor can it answer them or provide a rationale.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by rdedev on Thursday July 01, 2021 @08:17AM (#27698337)
If the programmer dosent have the requisite knowledge to verify the code it's hard to know if the generated results are correct. Compare this to copy pasting solutions from stackoverflow. Atleast there you get a pretty good idea of the pros and cons of a solution. With copilot it's all upto the programmers understanding of the generated code. Of that programmer propmts copilot on a domain they don't know much about it could lead to a lot of subtle bugs being introduced
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:19AM (#27698348)
> Compare this to copy pasting solutions from stackoverflow. Atleast there you get a pretty good idea of the pros and cons of a solution.

I don't think I understand why this should be true.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by dathinab on Thursday July 01, 2021 @08:28AM (#27698427)
Because on SO you:

- get multiple answers

- comments on the answers

- up/down votes

- explanations along side of the answer

and I still would argue you should never copy from stack overflow!! Instead understand why the answer is correct and then write your code based on that understanding, even if it produces the exact same code in the end.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pyrale on Thursday July 01, 2021 @09:07AM (#27698702)
Also, to get answers on SO you have taken the time to elaborate a question. Building up the right question is a significant part in the process of understanding.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @09:25AM (#27698802)
The vast majority of visits to SO are by people who don't even have an account. They're not asking questions themselves.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pyrale on Thursday July 01, 2021 @10:12AM (#27699217)
They may not be authors of the question on SO, but to find that question you need to search for it, and it is not uncommon that doing so takes more than one research/thread parsing. In the end, finding the relevant SO answer is not unlike asking a good question in the first place.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @10:31AM (#27699398)
If the question is more complex than "how do you do a parameterized query with ActiveRecord?" it's unlikely autocomplete is doing it for you either.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by nemetroid on Thursday July 01, 2021 @08:20AM (#27698357)
Stack Overflow answers only containing a code block are voted down.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:23AM (#27698386)
In theory, I guess, but the type of person who just blindly commits code they didn't understand isn't going to read the explanation and isn't going to catch security issues with SO answers either.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by MauranKilom on Thursday July 01, 2021 @08:43AM (#27698534)
The fact that some (bad) programmers already blindly copy SO code does not detract from the original argument that Copilot is dangerous because it effectively copy-pastes SO code blindly.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:47AM (#27698555)
It presents a suggestion, which you are free to reject. What's "blind" about it?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by nemetroid on Thursday July 01, 2021 @09:09AM (#27698717)
The fact that it doesn't come with context. I just fail to see the usefulness of the suggestion, if the quality can't be trusted. Either:

a) I'm familiar enough with the code/topic that I'm able to judge whether the suggestion is good, or

b) I'm not able to judge, and need to consult other sources.

In case a, I could have just written the code myself. In case b, I still need to read up, so the potential gain is that Copilot gave me a hint as to what I should search for. But even that hint can't be trusted - there was another comment where Copilot suggested to use MySQLi in PHP, which has been the wrong choice for a long time.

So if the suggestions need scrutinization, the target group I see is people who need to write a lot of code in a familiar area, and are limited by the speed at which they type. This is arguably a very small set of people, and is unlikely to be the main user group of this tool.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @09:30AM (#27698844)
When I visit SO, I generally read all the answers and can pretty immediately judge "I think this approach is good" or "I don't think this approach is good" just by reading the code. I can't see why these suggestions would be any different. And in the perhaps more common case where I already know exactly what I want to do it can still save time to have the plug-in autocomplete it (I make heavy use of tab completion today after all).
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by Master_Odin on Thursday July 01, 2021 @10:18AM (#27699277)
The mysqli extension in PHP is fine to use and has advantages over PDO if you only ever plan to interface with MySQL. Now, if it was recommending the mysql extension, that would be bad as that's been deprecated and replaced by mysqli for a very long time.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by sergiomattei on Thursday July 01, 2021 @08:02AM (#27698249)
Yeah, this point I really don't get.

Your job as a programmer is to ensure the correctness of the code you write, Copilot isn't really changing that.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by skohan on Thursday July 01, 2021 @11:50AM (#27700413)
If you went to school in CS, think about the worst programmer in your graduating class. You don't think they are going to mindlessly accept the autocomplete as long as it compiles? I can imagine this will lead to a lot of bad code making it into production.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by sergiomattei on Thursday July 01, 2021 @12:23PM (#27700829)
So? Systems should be in place to review code.

If you don't have these systems in place, you're getting what you deserve. Hiring subpar talent and not having processes in place isn't Copilot's fault.

This is almost like blaming the car for an accident. If you have a shitty driver and the traffic lights aren't working, it's not your Corolla's fault.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by baby on Thursday July 01, 2021 @08:10AM (#27698297)
You’d have to believe auto completion is evil too I guess
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by adrianmonk on Thursday July 01, 2021 @12:29PM (#27700913)
It is going to have the same vigilance problem as partial self-driving cars. When the machine feels like it's handling most everything for you, you let down your guard.

It shouldn't be that way, but it's how people work, so we should expect it to happen. (Psychologically, if an action is very rarely rewarded, people are less likely to do it.) Even if you want to be vigilant, it will be a bit of an uphill battle to make yourself do it.

Also, checking the auto-generated code takes time. You, as an individual contributor programmer, may believe that the time is absolutely worth it, but you will need management to support that. This technology creates additional opportunities for managers to say, "Don't worry about that. Ship it." Which is another thing that really shouldn't happen but in reality does.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by namelosw on Thursday July 01, 2021 @09:53AM (#27699050)
> Well, let's say you have a system in place where you actually prove the correctness of your program.

> Of course, when the correctness of your program does not matter in the first place, but just its output

1. There are in fact very, very few projects that try to prove their correctness. Usually, those are extremely critical or dependencies for potential critical applications. Even if a project does this they're doing it partially just for keeping ROI sane. Please correct me if I'm wrong but AFAIK, even most programs on aircraft don't use this approach, although they're definitely interested.

2. For most of the projects, the primary goal is to be useful, to be correct is at most secondary.

3. A program written by humans is not inherently correct, it's more likely to be the opposite. No matter it's written by a human or a machine, you should always write test cases to reflect the properties you care in your program. Properly tested programs written by the machine don't make it less correct than those written by a human.

I'm generally interested in Copilot, not because of the novelty it claims to be, but the value it might provide. I see it as a potentially useful tool just like IntelliSense but with greater potential.

At the end of the day, it's an AI "Pair". I've been doing pair programming for years, one of the lessons I learned is one should not assume anything just because he/her pair partner is doing it - both of them should be responsible for their program.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by ok2938 on Thursday July 01, 2021 @12:21PM (#27700817)
Yes, the wrongness is partly associated with the direction these things come from.

OpenAI leadership knows that there is just sooo much value to capture in more automation, even if it takes billions to get there. They also know, that there is sooo much money around not knowing what to do and so much excitement in the field generated by bystanders, not understanding a single thing.

Perfect setting for ride and reap.

I repeat: There is nothing open about this, the research scientists are being used in order to propel just another get rich sooner-than-later scheme (how should they know better, they are innocent scientists). Happy bulldozing what is left of society in order to generate profits and to shove the AI BS down the managerial class, because that's all just how the system works.

And, if know all that, you can exploit it, hacker.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by codingdave on Thursday July 01, 2021 @07:57AM (#27698220)
Copilot just has the wrong experience. There is nothing wrong with suggesting an algorithm with a code snippet as an example. That is its core use, and it does the job. It just needs the snippets to be clearly marked as such, with a way to track that you reviewed the code and adjusted it to your use case.

When people make security corrections to those snippets, ideally it would learn the corrections. Perhaps even have a feature to flag a snippet as insecure, to help that process.

Copilot is imperfect, yes. But there is a large grey area between perfect and "utterly wrong"

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by alexgmcm on Thursday July 01, 2021 @08:23AM (#27698393)
>But there is a large grey area between perfect and "utterly wrong"

Not on internet discussion boards.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by onion2k on Thursday July 01, 2021 @08:58AM (#27698635)
Of course, when the correctness of your program does not matter in the first place, but just its output, and you happen to be able to judge the quality of the output without knowing anything about your program, then something like Github Copilot makes sense.

So the problem is that Copilot will only work for 99.99% of all the code that's ever written?

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @09:04AM (#27698675)
The problem is, Copilot will work for 99% of the time you use it - or more like 60%, going by the examples on their front page) - and the remaining 1-40%, it'll give you subtly buggy code.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by onion2k on Thursday July 01, 2021 @10:36AM (#27699435)
the remaining 1-40%, it'll give you subtly buggy code

I think that's OK. Most code is subtly bugger no matter where it originated from. It's always going to be up to the developer to check and test what they're committing whether it's from Copilot, a co-worker, or they wrote it themselves. I think Copilot is meant as an aid to the code writing process, not a replacement. It's not really that different to any other tool.

Plus, fortunately, most code is never subtly buggy if you look at small enough parts. If it doesn't work correctly it's very obviously wrong. As Copilot is aimed (for now) at small functions any bugs will manifest in clearly broken outputs. It's when Copilot can generate entire classes, or whole applications, that we'll need to reassess if the code it creates is actually worthwhile.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by YetAnotherNick on Thursday July 01, 2021 @07:59AM (#27698232)
Just look into the name of the program. It's "copilot" and in my understanding the intention is just to give suggestion and in not to write provably correct program which matches some given specification. Think of it as 10x of autocomplete, not 1/10x of human replacement.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by rightbyte on Thursday July 01, 2021 @08:02AM (#27698252)
A "copilot" is also a pilot and can take over when needed. The name does not imply helper, cheerleader or advisor.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by falcolas on Thursday July 01, 2021 @09:37AM (#27698907)
Co-Pilots are fully qualified pilots. They can take over 100% of the jobs of the Captain if they need to.

Just like Tesla’s Autopilot, this was poorly named, at a minimum.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by simias on Thursday July 01, 2021 @07:55AM (#27698203)
I don't really share your opinion, I think bad devs will write bad code and good devs will write (mostly) good code, with or without it.

The problem exhibited in TFA is not so different from people copy/pasting StackOverflow answers without understanding them.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by saurik on Thursday July 01, 2021 @09:43AM (#27698961)
Ok: and since I would hope we agree that no one worth being a software developer is just blindly copying code off of stack overflow into their code, Copilot is certainly a horrible idea if what it is doing is making that easier or "cooler", right? :/

If we start by assuming the developer is a "good dev", I can't imagine Copilot is going to do anything useful for them, as this isn't going to be a useful way for them to come to understand how the system they are using works, and it won't support them building abstractions to reduce boilerplate. This tool is simply not useful for them.

Which leaves us with the idea what Copilot is a tool designed for "bad devs" to be able to do less work to do the bad things they do, and while I sort of appreciate the idea of "it is worthwhile to support people who don't know what they are doing in their attempt to do the bad thing they are doing anyway", I have severe reservations about doing that with engineering... it at least needs to be marketed as that!

Otherwise, the two main things we should be doing for "bad devs" is either helping them become "good devs"--which this doesn't do for much the same reasons it isn't useful for "good devs"--or we should honestly be trying to convince them not to be a developer at this level at all (which might include building higher-abstraction systems that are easier to use and understand).

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by wyuenho on Thursday July 01, 2021 @08:02AM (#27698255)
The problem is with Copilot, or over-relying on it for its purported convenience, bad devs will have a harder time becoming good devs. Discovering what code to write and what their exact effects are is a major part of the journey to becoming good dev. If humans aren't going thru this process, I very much doubt they'll be able to quality control the code Copilot dumps in until later in the cycle. Doing things the hard way is essential for being a good dev.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:21AM (#27698361)
I've heard this same line for using IDEs for years. Everyone else is welcome to stick with Ed if they like. I'm going to use the tools that are available to me to make my job easier.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @08:42AM (#27698527)
If you don't understand the difference between Idea IntelliJ, which I loved as soon as it came out, and Github Copilot, then you are exactly the reason why I am frightened.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:51AM (#27698581)
IntelliJ and friends make a lot of suggestions, which aren't always good to blindly accept. It's not exactly the same but it's in the same universe of machine-assisted work that still requires human direction.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by pyrale on Thursday July 01, 2021 @09:11AM (#27698725)
There's a pretty big difference between asking a permission and going on unless that same permission is denied.

There's also a large difference in scope between the kind of suggestions a linter gives and what copilot does. Linter usually works around the syntax for equivalent semantics, while copilot tries to infer semantics.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @09:24AM (#27698793)
IntelliJ does a lot of the latter with templates.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by marcosdumay on Thursday July 01, 2021 @12:39PM (#27701060)
Code templates are the top reason why I avoid IDEs. You just start writing something and the IDE will insert a block of code there, with no indication of where it ends, and catching you off guard if you are focused on something other than data input.

The fact that there are so many people that like them that all the IDEs have the feature on by default with the off switches scattered all over their configuration so you can't turn them off is scary.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @03:34PM (#27703528)
I'm not sure what's scary about it. I find them useful. And I find the behavior is pretty predictable with experience.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IncRnd on Thursday July 01, 2021 @08:54AM (#27698602)
When you work for a company that forbids copilot and blocks its traffic from the network, you'll find that your dependence on tools to create your code has held you back.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by emodendroket on Thursday July 01, 2021 @08:59AM (#27698636)
Heard that one before too. I have to work without the IDE for interviews and it's not a big deal. It's just slower and less efficient.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by azangru on Thursday July 01, 2021 @08:04AM (#27698263)
How is github copilot worse than a very laborious but a very junior developer who can search stack overflow for you and bring you code snippets that sometimes are spot on and sometimes are plain wrong? Presumably that's why code review exists...
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by azornathogron on Thursday July 01, 2021 @08:25AM (#27698402)
A very junior developer that brings me code snippets that are sometimes plain wrong is not useful to me directly - such a developer costs more time in review than they save by providing the snippets in the first place. The value of such a developer is that over time and with some mentorship they will become a slightly less junior developer who can bring me whole features that I can be reasonably confident are mostly correct.

Having said that, I don't know how the much more integrated write/review/edit cycle will work in practice when using copilot. I don't think it will be the same as a junior developer/pair programming partner in any real sense. My initial reaction to copilot is negative, but I'm open to being proven wrong about it.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by naniwaduni on Thursday July 01, 2021 @09:01AM (#27698653)
This point might be a bit lost in the current state of the industry as HN is exposed to it, but usually the idea behind keeping a very junior developer around is that gradually it'll stop being a very junior developer and become a slightly less junior developer who will spit out code snippets that aren't usually just plain wrong.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by TeMPOraL on Thursday July 01, 2021 @08:22AM (#27698374)
- The exact StackOverflow snippet said junior is copying was seen by others and likely already debugged to some extent. There's typically also a lot of relevant information in the text surrounding the snippet.

- The snippet you get from Copilot is generated by an DNN model. I'd think that alone should scare people. DNN models are correct on a continuous scale, not discrete. A bad pixel on a generated image, an extra comma in generated text, are considered OK. That kind of correctness framework doesn't work with code.

From what I read, Codex (the model powering Copilot) is a GPT-3 derivative. Surely you've played with GPT-3 before, you've seen the types of mistakes it makes. In my eyes, this approach just won't fly for code.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IncRnd on Thursday July 01, 2021 @08:56AM (#27698617)
> - The exact StackOverflow snippet said junior is copying was seen by others and likely already debugged to some extent. There's typically also a lot of relevant information in the text surrounding the snippet.

Empirically, this is false. There is an incredibly high amount of bad, incomplete, or vulnerable code on SO.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by yarcob on Thursday July 01, 2021 @08:20AM (#27698356)
We have mandatory code review for every commit that goes into our app, and still stuff like that routinely slips through. You need a lot of experience to spot errors like this, and stuff will still slip through.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by tengbretson on Thursday July 01, 2021 @12:26PM (#27700867)
I often find that doing good code review is much more exhausting than writing good code. Anything that puts more garbage on my plate for review is a net drain on resources.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by IncRnd on Thursday July 01, 2021 @08:55AM (#27698611)
The difference is that copilot constantly emits code visibly on the screen.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by staticassertion on Thursday July 01, 2021 @10:02AM (#27699128)
I'm quite excited for copilot. I don't even know that I'd have caught that bug, but I'm sure I could see myself having written it, so it's really no worse - that's why I work on a team with others who likely would have.

I'm not worried about it suggesting subtly wrong code. I write subtly wrong code all day every day, and sometimes I catch it, and sometimes I don't. I write tests, I use types, etc. I'll use the same tools to reduce bugs from copilot that I do for myself.

I'm not really worried at all.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by slver on Thursday July 01, 2021 @12:10PM (#27700656)
> The amount of people who think that GitHub Copilot is a good idea is just frightening. Just shows how many people never thought about the semantics of their programs for even a second.

I think it's an excellent idea. People who copy-paste from Stack Overflow will also copy lots of shitty code or use it incorrectly.

But those of us with a clue, have a neat prototyping system where we can modify the solution until it's coherent. It's still on us. Copilot never claimed to produce the best code. And doesn't have to. That's the whole point behind the "pair programming" metaphor.

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by sli on Thursday July 01, 2021 @01:27PM (#27701757)
About the only code generation I've ever liked is the pure-convenience stuff, like generating a complete (but empty) pattern matching constructs for whatever algebraic type I'm matching on (e.g. case-of). Otherwise, all I want are good suggestions for code completion.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by marcosdumay on Thursday July 01, 2021 @11:54AM (#27700455)
> Of course, when the correctness of your program does not matter in the first place, but just its output, and you happen to be able to judge the quality of the output without knowing anything about your program...

Those are way too many words to say "never".

Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @03:47PM (#27703706)
It's not never. Look at generative art. If you like the output, great. No need to know how the program did it (except maybe for copyright infringement issues :-)). Or if the AI proves the correctness of a program. The output is the proof, I don't need to know how the AI did it. And so on.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by habibur on Thursday July 01, 2021 @08:13AM (#27698321)
Things will improve over time. Like all tech. But it's here to stay, like it or hate it.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by vanviegen on Thursday July 01, 2021 @07:50AM (#27698182)
What would you say they'd have to do differently/better to get it right?
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by auggierose on Thursday July 01, 2021 @07:58AM (#27698223)
The thing is, the technology to do it right is just not there yet. So unleashing this stuff without making sure it can be controlled the right way is basically a Jurassic Park scenario.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by bregma on Thursday July 01, 2021 @08:08AM (#27698286)
First prerequisite: solve the halting problem.
Re:Don't encode POST bodies like GitHub Copilot, use URLSear... by e-clinton on Thursday July 01, 2021 @08:51AM (#27698585)
In order for AI to be the future, it needs to be the present first… and of course people will criticize. Let’s give it a chance to evolve. And if you have something to contribute to the movement, then build your own tool.