Poor code quality due to AI assistants GitHub Copilot and ChatGPT
blobstreaming.org
blobstreaming.org
My thoughts around code quality are generally that if you're writing code for yourself (as a hobby, for open source, whatever) -- then write code however you want, as it's for fun. Obviously, others can contribute fixes and help make things better, but there's no professional "responsibility" in these cases.
On the other hand, if you're writing software meant to be used by others (including companies you work for), it's your responsibility as a developer to ensure the code you're pushing is:
- In compliance with style conventions
- Properly reviewed for security issues (tools like Snyk and other SAST/SCA tools work well for this)
- Makes architectural sense given the rest of your codebase
- Is documented so others can easily contribute/review without a lot of handholding
The rules above are true regardless of how the code is being generated.
We're still in the early days of AI and there are certain things that code assistants excel at today, and there are things they do very poorly at currently.
Now this is not necessarily a bad thing. I have seen a lot of code that is trying to follow the DRY principles and the result is horribly tangled mess where you have no idea what gets when executed by just looking at the code.
There is also hope that AI summarizing ability could help to gain a better systematic understanding of the code. Perhaps it's generalization capabilities could even help to refactor the code and build up a good test suit.
But this is to be seen to happen and better awareness is an advantage.
I only knew to be aware of and correct these issues because I have decades of experience writing software. Modern business practices won't give junior developers the time to learn good practices and they won't get much mentoring because the senior people disappear after a couple of years.
I personally didn’t see suggestions that would have significant impact on code quality - simply helping one more quickly express initial concepts including all the language necessities. Intellisense++ish.
I have only seen it assist developers who were going down a bad path get there more quickly. I have not observed anything that would encourage/discourage any design pattern or developer choice.
My gut tells me that the fact that devs can more quickly deliver a “solution” (bad/good) means that they deliver their fat PR and … well … it’s fat - so it’s not scrutinized as well as it might have been had the dev taken some time and another set of eyes hit their branch before they got too far along. It’s often much harder to get the proper attention and review on a large-ish PR than it is to peek in along the way.
I personally couldn’t find anything that I feel would inherently lead to lower quality code. I do see how devs could more quickly deliver their low quality code and it can be a challenge to deny that code.
I’m left on the fence. I’ve found it valuable for autocompletion of what I’m about to express, but I also have no illusion that it’s going to tell me that what I’m about to express is stupid and/or of low quality.
Those things about quality are also quite language specific. Not so much about guessing what you might be about to type for tab-completion.
Also note - it’s about efficiency - as GitHub has stated. Duh. Notice copy/paste declined? Tab-completion. How many jr devs have you seen that won’t just write out a function declaration, they copy paste an entire function, gut it, and write their code. Odd to me, super slow and lame, but even I have seen the utility of tab-completing empty function blocks that are 90% of what I wanted.
Sooo. I’m inclined to say it’s interesting - but in no way at all diagnostic, deterministic or a very good study when it comes to writing conclusions. These are hyperbolic statements. Nearly link-bait.