Code quality and maintainability
I found an interesting article about code quality and maintainability of AI generated code.
This is the TL;DR:
GitHub Copilot usage has led to an increase in AI-assisted code, which in turn has created a downward pressure on code quality. Code written with AI is often harder to maintain and of lower quality as itβs often verbose or copy-pasted. However, GitHub Copilot has had a positive effect on developer productivity and satisfaction.
My conclusion
So it looks like, that you have to be careful when using Copilot to not trade higher initial productivity right now with higher maintenance cost in the future...
What's your opinion?
Photo by Mimi Thian on Unsplash
Top comments (7)
I think: Most likely yes.
I've already been guilty of sneaking in a comment that didn't make sense because it was generated. This happens enough time and you lose the point of the code.
I don't think it's an all-or-nothing thing, but I suspect a lot of generated code is going to be on the low-readability spectrum.
At my company, we are having big discussion on when to use generated code vs when not to, specifcly to test the maintainability.
We had to greate a custom data handler, that manipulates some Json data, stored in a SQL database, with basic CRUD operations.
I tried first to make the full implementation myself, and then using ChatGPT-4.
To then test the maintainability, one of my coworkers was tasked with updating the schema of the Json to support a new property. He then went and did this in both solutions.
The result was pretty clear. The generated code, was harder to alternate to support this new property, while the human created code was much easier.
To sum up, out findings:
Our conclusion is therefore, that generated code is good for idea generation and getting some quick solutions, but it must never be fully copied.
Very interesting experiment. Thanks for sharing it.
Thanks for sharing.
IMHO, a tool is a tool. With it, you can build great things or a pile of crap. This depends largely on the wielder, not the tool.
As Grady Booch once said: