News for hackers. Stuff that matters.
Re:I figured out how to get GitHub Copilot to run in the ter... by teddyh on Thursday September 15, 2022 @05:28AM (#32849277)
It’s generally claimed that reading other people’s code is harder than writing your own. I mean, everybody loves writing code on a greenfield project but hates maintenance of legacy code, right? So, why do people like these code generators? The only explanation I can see is that people use them and then don’t read the code. Which would be horrifying.

(I stay away for obvious copyright reasons.)

Re:I figured out how to get GitHub Copilot to run in the ter... by temp_account_32 on Thursday September 15, 2022 @05:56AM (#32849481)
It is absolutely amazing for writing boilerplate code that is also context aware. It saves me hours of typing. It's hard to explain if you've never tried it because you're ideologically opposed to it, but stop being close minded and try it out, I promise it's a great tool to assist your programming.
Re:I figured out how to get GitHub Copilot to run in the ter... by danogentili on Thursday September 15, 2022 @07:05AM (#32849976)
Good codebases don't need boilerplate to do basic stuff: in this sense, copilot is a patch over the real problem, which can be solved with better frameworks and more code reuse.

I tried copilot during the beta, and apart from the obvious legal licensing issues, I simply could not find a valid usecase for any of the codebases I usually work with.

At my day job, I spend more time thinking of better ways to do X, rather than writing boilerplate code :)

Re:I figured out how to get GitHub Copilot to run in the ter... by xyzzy_plugh on Thursday September 15, 2022 @09:09AM (#32851337)
I disagree. Some amount of boilerplate is preferred versus abstracting everything. Boilerplate can be frustrating to write, and fiddly boilerplate absolutely should be abstracted, but in general it should makes the flow of logic easier to follow.

> At my day job, I spend more time thinking of better ways to do X, rather than writing boilerplate code :)

Not that you are suggesting otherwise, and I am being somewhat facetious, but oftentimes boilerplate is preferred to boiling the ocean.

Re:I figured out how to get GitHub Copilot to run in the ter... by jackson1442 on Thursday September 15, 2022 @11:54AM (#32853934)
A million times yes. If a codebase is magically adding _all_ of the boilerplate, it's almost always harder to understand what's actually happening.
Re:I figured out how to get GitHub Copilot to run in the ter... by williamcotton on Thursday September 15, 2022 @07:56AM (#32850394)
I have found Copilot useful while writing compilers and virtual machines all the way up the chain to CSS grids and media queries.

Are you telling me there isn’t a fair bit of boilerplate in bog standard implementations of OP_ADD or in a grid layout with a sidebar and a footer?

The irony here is that the level of abstraction necessary to remove all boilerplate means that you’re removing the descriptive nature of the boilerplate and making your code difficult to understand.

Boilerplate isn’t necessarily a bad thing but sometimes it can be rather verbose and it is very nice to offload that typing to a tool.

Re:I figured out how to get GitHub Copilot to run in the ter... by williamscales on Thursday September 15, 2022 @08:26AM (#32850725)
Whenever I have boilerplate in a codebase I try to make a tool to create it for me. So copilot does seem like an extension of that.

I think the thing that weirds me out about copilot is that I can't peer inside it. I guess I like knowing something will always work?

Re:I figured out how to get GitHub Copilot to run in the ter... by artificialLimbs on Thursday September 15, 2022 @10:28AM (#32852588)
If it doesn't work, you don't have to accept its recommendation. You just keep coding.
Re:I figured out how to get GitHub Copilot to run in the ter... by netr0ute on Thursday September 15, 2022 @07:18AM (#32850076)
What are some examples of code without boilerplate?
Re:I figured out how to get GitHub Copilot to run in the ter... by pleas4nt0ne on Thursday September 15, 2022 @09:52AM (#32851968)
At your job the boilerplate was probably written already and you can avoid it.

Not all jobs are on mature projects.

I get tired of highly subjective anecdotes being used as concrete truths.

You are not the center of reality as we don’t know there is one. So good on you for having a job where the boring work was already in place. Look how far you have come on your own leveraging past effort. So proud of you.

Re:I figured out how to get GitHub Copilot to run in the ter... by antihero on Thursday September 15, 2022 @10:10AM (#32852295)
This way lies hellish amounts of indirection.
Re:I figured out how to get GitHub Copilot to run in the ter... by soulofmischief on Thursday September 15, 2022 @09:49PM (#32861060)
You're completely missing the point of copilot. It speeds up typing by 10% or more in highly organized codebases. Strong codebases synergize with copilot, they don't compete.

10%+ speedup is a huge, obvious win. Anything that increases my productivity is good.

Re:I figured out how to get GitHub Copilot to run in the ter... by JeremyNT on Thursday September 15, 2022 @11:04AM (#32853099)
I am curious about the hours of typing thing. I don't normally need much boilerplate, so I normally just type things. If I do need boilerplate, I yank the boilerplate into a buffer and put it into the file I am working on. Yet I feel like the overall time spent doing this is incredibly slight.

I feel like it's possible some time could be shaved off somewhere there, but this all happens very quickly and it's not an area where optimization would improve things much overall. For this to amount to literal hours of typing, I think I would need to be either very much slower at typing, writing an immensely large volume of boilerplate, or working over many many years. Typing stuff is essentially never a bottleneck for me.

[dead]
Re:I figured out how to get GitHub Copilot to run in the ter... by nindalf on Thursday September 15, 2022 @08:52AM (#32851087)
Calling fellow commenters stupid or ignorant isn’t right. Please reconsider.
Re:I figured out how to get GitHub Copilot to run in the ter... by Nanana909 on Thursday September 15, 2022 @08:38AM (#32850880)
I was against copilot until I tried it.

It’s not always on target, but it’s usually pretty close and the suggestions are good.

No, it doesn’t write all of the code for me. But it does rapidly construct even quite complicated if/else statements that I was going to write anyways, just from knowing where I’m typing. Quite a great tool.

Re:I figured out how to get GitHub Copilot to run in the ter... by adammarples on Thursday September 15, 2022 @08:56AM (#32851153)
I was just revisiting an api call which it turns out needed pagination. I put a note in the docstring before I began and copilot just... rewrote the function to include pagination. Except for a couple of corrections to the json returned by the api (copilot could only guess), it just worked! I'm amazing by copilot and it frequently writes chunks of my code, especially shell scripts and docker files. A little worried that my job might be on the way out at some point!
Re:I figured out how to get GitHub Copilot to run in the ter... by Nanana909 on Thursday September 15, 2022 @01:34PM (#32855574)
I love it but it’s nowhere near the level of replacing anything but the lowest skill developers. The actual real skills involved with deciding what problems to solve, architecting and developing complex software would require general AI level AI, and at that point a *lot* of people are going to be out of jobs.
Re:I figured out how to get GitHub Copilot to run in the ter... by artificialLimbs on Thursday September 15, 2022 @10:30AM (#32852629)
I prefer to think that I'm learning $x much faster because I don't have to go hunting documentation nearly as often.
Re:I figured out how to get GitHub Copilot to run in the ter... by cube2222 on Thursday September 15, 2022 @05:48AM (#32849411)
I think many people see GitHub Copilot as a code generator, without having used it, and then wonder like you.

But afaik almost everybody uses it as autocomplete on steroids.

So the reasoning behind using it is the exact same as using autocomplete in I.e. Intellij.

It's just slightly more powerful, since it will usually autocomplete the whole line (occasionally a bit more), instead of just the current keyword.

Re:I figured out how to get GitHub Copilot to run in the ter... by greenhatman on Thursday September 15, 2022 @02:45PM (#32856632)
It sometimes completes whole functions for me, from which I just have to make minor corrections afterwards. Some of which would have required me to lookup syntax 2 or 3 times. So it saves a lot of time in that way.

I do find it's much better in some languages though. And probably especially with languages you're new in. It doesn't do much for me in PHP, but does a lot in JavaScript.

Re:I figured out how to get GitHub Copilot to run in the ter... by eatsyourtacos on Thursday September 15, 2022 @10:39AM (#32852747)
Exactly this!

And it's scary how good it is for "autocomplete" sometimes. I've found it much more useful on our angular webside frontend rather than the c# backend.. but man on the angular/javascript side it really saves time.

I can't think of any good examples off the top of my head, but every few days I literally am wondering to myself "how did I now I wanted to do exactly that!"

Re:I figured out how to get GitHub Copilot to run in the ter... by fassssst on Thursday September 15, 2022 @09:55AM (#32852006)
I use them to quickly learn new languages or libraries. E.g., I’ve done only C++ for a few years and got rusty in other things. I used copilot to quickly learn how to create a Python Flask server, how to draw shapes on an HTML canvas with JavaScript, how to write common algorithms like “generate a random number in this range” without having to reach for pen and paper, etc. all without leaving my editor. It’s kind of like a much faster Google search for a StackOverflow result, and keeps you in the flow.

Disclosure: I work at Microsoft, opinion is my own.

Re:I figured out how to get GitHub Copilot to run in the ter... by lake_vincent on Thursday September 15, 2022 @01:17PM (#32855296)
I'm sorry, but this is an incredibly shallow analysis. You don't even know what CoPilot is, apparently, and yet you speak in these broad generalities that are misguided at best. It's the only explanation you can see because clearly you haven't looked...
Re:I figured out how to get GitHub Copilot to run in the ter... by jsharf on Thursday September 15, 2022 @11:18AM (#32853341)
It's good enough that I wouldn't really call it a code generator, and I wouldn't put it in a category with other tools due to the performance different from anything else like it.

Often, it creates code that follows the style of the surrounding environment.

Honestly at this point, the copyright concern seems either ignorant or paranoid to me. The program is interactive and generally only creates small chunks of code at a time. You can read and modify the code it generates (I always do). I only operate on it in digestible chunks, none of which are "original" enough to be considered copyright. Surely, you as a developer can easily say whether the code generated is just some non-copyrightable snippet (some simple BFS code) vs stolen code lifted off a codebase (weirdly specific implementations, fast invsqrt, comments that look like they were written for a different context, magic numbers, undiscovered algorithms).

I would argue that if you can't differentiate between meaningful IP and boilerplate algorithm implementations (with variable names conveniently matching the surrounding context), then you have a different problem.

Yesterday I implemented a BFS in about 30 seconds because copilot recognized the pattern and auto-completed. It took 5 seconds to autocomplete, and 25 seconds to read and fix one line that was wrong. That normally would have taken me 5-10 minutes to code + debug (the copilot code didn't have any errors, minus the 1 I easily found). The productivity gains are too good.

Re:I figured out how to get GitHub Copilot to run in the ter... by corobo on Thursday September 15, 2022 @07:43AM (#32850271)
> reading other people’s code is harder than writing your own

This is the first time I've ever seen this lol. I'd have had a hell of a time learning how to code if that were true!

Re:I figured out how to get GitHub Copilot to run in the ter... by never_inline on Thursday September 15, 2022 @05:32AM (#32849305)
> So, why do people like these code generators?

To cover the lack of good libraries and/or language abstractions.

Re:I figured out how to get GitHub Copilot to run in the ter... by bgro on Thursday September 15, 2022 @02:31PM (#32856399)
This is a bit off topic, but I am naturally excellent at reading other people's code. I can somehow factor in commit messages and see their style to determine if they didn't know X area very well, if it was a temporary hotfix, or if they intended to come back and fix this area up at a later time. It's like I'm sitting there with them while I read it.

Is there a job title where I can put this to use? I'm alright in general feature work, generally exceptional in bug fixes or finding exploits, and exceptional in code reviews. I always get stuck in leetcode tests of technical interviews though despite having like 8 years of experience.

Re:I figured out how to get GitHub Copilot to run in the ter... by ChicagoBoy11 on Thursday September 15, 2022 @09:46AM (#32851863)
I've found myself needing some snippet of code that has a very targeted function, and whenever I see something online that's close enough, I sometimes paste that in my code and then make the necessary adjustments. This pattern is common enough (at least in my workflow) that if I could just start writing in the editor and it did a decent job figuring out what I was going for (in much the same way as my google query), and then let me dive straight into adjusting it, that's kinda nice.
Re:I figured out how to get GitHub Copilot to run in the ter... by greenhatman on Thursday September 15, 2022 @02:42PM (#32856577)
You know all the times you need to lookup syntax or how to do something on Stack Overflow or some other site? Copilot replaces about 80% of that. Speeds up that process a lot.
Re:I figured out how to get GitHub Copilot to run in the ter... by Closi on Thursday September 15, 2022 @06:45AM (#32849828)
> It’s generally claimed that reading other people’s code is harder than writing your own. So, why do people like these code generators?

Harder doesn't mean quicker :)

Re:I figured out how to get GitHub Copilot to run in the ter... by pmarreck on Thursday September 15, 2022 @08:41AM (#32850921)
nothing tells me you've never even tried it as much as this comment of yours

it is "intelligent context-aware code autocomplete on steroids"

Re:I figured out how to get GitHub Copilot to run in the ter... by teddyh on Thursday September 15, 2022 @10:38AM (#32852730)
> nothing tells me you've never even tried it as much as this comment of yours

You mean the part where I said that I haven’t tried it?

Re:I figured out how to get GitHub Copilot to run in the ter... by pmarreck on Thursday September 15, 2022 @11:31AM (#32853598)
Hah, fair. Honestly, it's great. It's great in 2 ways:

1) When it's 100% correct, I smile, because it's often very clever, and as a programmer whose very existence is based on work elimination, when that amazing technological weapon is aimed at my own work needs as a developer, this is some Inception-level glee.

2) It's often wrong. Maybe like, 33% of the time? BUT when it's wrong (note that 95% right is still "wrong," so it's still very good), I smile, because it's often STILL clever, even in its wrongness, and this cleverness amuses me while working. For example, I use Elixir, which linguistically (but NOT semantically) is very similar to Ruby, so on occasion I've seen it make a Ruby-flavored suggestion to my Elixir. "Silly Copilot," I'd say smiling as I'd correct it (and probably teach it further).

So basically, it's made my day slightly more joyful, which is great. I already enjoy programming, so watching a program try to write my code ahead of me is absolutely fascinating.

Simple example of labor saving- I was doing some bash scripting and I wanted some constants for ANSI colors. Well I started writing them, and Copilot finished the whole damn table (with correct constant names, using the naming pattern I'd already established). And all the color codes were correct. This was wonderful! It's GREAT for language domains you're not hugely familiar with. Like, know how you have to often look something up working in a lesser-used language? Well in Copilot, you can just start writing a comment describing what you need or what the code will do, and 8 times out of 10 it will then spit the actual correct code out for you, it's just amazing.

Oh, tip: There's a keystroke combo that will advance through various suggestion possibilities. Often the first suggestion is not quite there, but another suggestion is.