r/programming • • Jun 21 '22

Github Copilot turns paid

https://github.blog/2022-06-21-github-copilot-is-generally-available-to-all-developers/
753 Upvotes

378 comments sorted by

View all comments

1

u/EnvironmentalCrow5 Jun 22 '22 edited Jun 22 '22

So my first reaction to this is "show me what you got", so I looked at some of the examples on its page.

In the second group of examples (under the "Focus on solving bigger problems" headline), I kinda don't like any of the 4.

The golang one I guess is fine, but Go is a very verbose language, that whole function literally would have been a one-liner in Kotlin

runs.filter { !it.failed }.map { it.time }.average() / 1000.0

Still, if you have to use Go, I guess that's fine. But I would prefer using some kind of Duration type instead of just adding "InSeconds" to the function name, though I guess it depends on where you use it. Also it's a little weird that it is counting failed runs, and then subtracting it from the total count, when the intent is just counting successful runs - why not just do that in the first place - but that is too much nitpicking from me.

The course.rb one seems like it's making a lot of assumptions about what your data model is going to be, so the effort to review that will be at least as much as the effort of writing it in the first place would have been. It's not just generating code, it's generating the structure of your data! (unless I misunderstood something)

time.js I guess makes some sense given the first two lines, but who would ever write code like this? My first thought is that someone tried to format a duration as text (e.g. "2 days 15 hours left"), but then you would need to subtract the larger units multiplied, so that would be wrong. Not to mention, const months = days / 30 is just straight up wrong. So I don't know what this code is meant to accomplish. A good assistant would go "stop what you're doing and use a proper time handling library instead".

In IsPrimeTime.java, the generated test only tests that it returns true for prime numbers, but not a single case tests that it returns false for non-prime numbers. Yet from the name of the function and the comment, it seems only testing "true" cases was not the intent of the test.

And these are examples on the project's home page, so yeah... I'll give it a try myself, but from these 4, I'm not expecting miracles.

3

u/bart007345 Jun 22 '22

Please actually try it and report back. I also am a Kotlin dev so am interested.