New GitHub Copilot Research Finds 'Downward Pressure on Code Quality'

3 years ago by walter_wiggles to c/programming

'We find disconcerting trends for maintainability.'

Interesting to see the benefits and drawbacks called out.

uthredii 39 points 3 years ago

In this regard, AI-generated code resembles an itinerant contributor, prone to violate the DRY-ness [don't repeat yourself] of the repos visited.

So I guess previously people might first look inside their repo's for examples of code they want to make, if they find and example they might import it instead of copy and pasting.

When using LLM generated code they (and the LLM) won't be checking their repo for existing code so it ends up being a copy pasta soup.

path: 0 7072717, hotness: undefined, score: 39, children: 11
sentient_loom 22 points 3 years ago

If you use AI to generate code, that should always be the first draft. You still have to edit it to make sure it's good.

path: 0 7072717 7073554, hotness: undefined, score: 22, children: 10
walter_wiggles 15 points 3 years ago

I totally agree, but I don't hear any discussion about how to incentivize developers to do it.

If AI makes creating new code disproportionately easy, then I think DRY and refactoring will fall by the wayside.

path: 0 7072717 7073554 7074141, hotness: undefined, score: 15, children: 8
sentient_loom 5 points 3 years ago

How do we currently incentivize developers to keep it DRY? Code review still exists.

path: 0 7072717 7073554 7074141 7074646, hotness: undefined, score: 5, children: 4
MNByChoice 9 points 3 years ago

Code review still exists.

For now code reviews are done by competent people. What about once

AI makes creating new code disproportionately easy

?

Edit: Is it clear the quote, plus the items before and after are all one thought? I am hopeful, but not convinced.

path: 0 7072717 7073554 7074141 7074646 7076846, hotness: undefined, score: 9, children: 3
tatterdemalion 4 points 3 years ago

Because it will lead to an incomprehensible mess. Ever heard the quote, "Programs are meant to be read by humans and only incidentally for computers to execute"? This is well-trodden ground in science fiction. If you have AI writing code that's so lacking in abstraction (because machines require less of it to understand) then humans will become useless in maintaining it. Obviously this is a problem because it centralizes responsibility of maintenance onto machines who depend on this very code to operate.

path: 0 7072717 7073554 7074141 7098756, hotness: undefined, score: 4, children: 0
Honytawk 1 point 3 years ago

If the AI is creating the code, it is up to it to keep itself DRY

path: 0 7072717 7073554 7074141 7079916, hotness: undefined, score: 1, children: 1
sentient_loom 2 points 3 years ago

Well that means it's up to us to make it recognize non-DRY code and teach it to refactor while remaining coherent forever and ever, or else we'll have to parachute into lands of alien code and try to figure out something nobody wrote and nobody understands.

path: 0 7072717 7073554 7074141 7079916 7100592, hotness: undefined, score: 2, children: 0
hikaru755 8 points 3 years ago

Yeah, but by generating with AI you're incentivized to skip that initial research stage into your own code base, leading you to completely miss opportunities for consolidation or reuse

path: 0 7072717 7073554 7098922, hotness: undefined, score: 8, children: 0
MaoZedongers 16 points 3 years ago

what a shocker

path: 0 7074380, hotness: undefined, score: 16, children: 0
chepox 12 points 3 years ago

I use it mostly as a help menu. Details of the function and parameter settings. Also fixing errors. I don't use it to generate code for me though.

path: 0 7074326, hotness: undefined, score: 12, children: 6
conciselyverbose 19 points 3 years ago

Using it to generate code isn't inherently bad (outside of copyright concerns). Especially in "stupid amount of boiler plate" languages/etc.

But the problem is that people are lazy. They don't bother understanding the output, making sure it does what you want it to, etc. It's not that different than people copy pasting code from reference material. Part of the beauty of software development is that you don't have to solve every problem someone else has already solved. But you do need to know what your code is doing and why.

Copilot is a shortcut to code that "works" with less requirement to know what's happening.

path: 0 7074326 7074649, hotness: undefined, score: 19, children: 2
evatronic 8 points 3 years ago

I thought we solved the boilerplate issue with templates and snippets like 30 years ago.

path: 0 7074326 7074649 7074682, hotness: undefined, score: 8, children: 1
lemmyvore 5 points 3 years ago

Not only that, but we solved it in a deterministic manner. The way LLMs go about it, by picking something they think sort of maybe looks like the right thing is more bother than it's worth.

path: 0 7074326 7074649 7074682 7079690, hotness: undefined, score: 5, children: 0
Landless2029 6 points 3 years ago

It's awesome for debugging for me.

Also helped me a few times with recursive logic.

As with any AI solution it's "garbage in. Garbage out."

Write your code normally. Then ask to generate comments? Add logging? Any tips for improvements?

You have to already know how to code so you know what to ignore.

path: 0 7074326 7083559, hotness: undefined, score: 6, children: 1
bruhduh 5 points 3 years ago

Exactly, ai only speeds up your coding, quality still depends on you

path: 0 7074326 7083559 7099433, hotness: undefined, score: 5, children: 0
linearchaos 3 points 3 years ago

If I don't use copilot to give me a piece of best practice code, I'm probably going to go and find it with a search engine.

Obviously I'm not going to do it for every little thing but if I'm going to implement a * somewhere I screw with that what, once every 5 years?I'm going to go and look how someone else did it and probably take their exact implementation and make minor modifications.

I'm not an absolute copy and paste fiend but I don't have the time to reinvent the wheel every time I want to do something. For the most part it's faster to go and grab crowd vetted code from someone that it is to go back through my own stuff and source my own implementation in the last project. Hell, and a lot of cases there might even be a better implementation than I used the last time I borrowed it from someone else.

path: 0 7074326 7087442, hotness: undefined, score: 3, children: 0
programming
programming

@programming.dev

login for more options
28153
3512
3435

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev


go to feed...