SHOCKINGđ€Ż. AI Destroys Code Quality
The biggest enemy in software engineering isnât tech debt. Itâs code churn, which is when code is changed shortly after being written. Itâs not only an indicator of problems but can be a cause of issues itself.
So, when you see this graph, you know something is up. You know what it is? AI. AI is destroying our code. Let us have a little chat about it and figure out what we can do.
https://www.gitclear.com/coding_on_copilot_data_shows_ais_downward_pressure_on_code_quality
Letâs look at the evidence
GitClear has released a white paper about how AI code-gen tools have impacted code quality. Itâs not in a good way and they should know (they draw on 150 million lines of code).
The burgeoning churn they found points to a deep issue. AI is fostering an increase in âcopy-pasteâ and a focus on the speed that extra lines of code can be added. We shouldnât be looking at coding speed as a metric at all.
Speed != Quality
GitHub claims code is written â55% fasterâ with Copilot. Developers love that and enjoy pushing out new code and delivering features.
The problem is that Robert C. Martin (whom I seldom agree with) claims that code spends 10x more time being read than written.
Iâd rather listen to my own experience. Iâve seen junior developers jump on the âpush codeâ bandwagon. Theyâre going faster than ever and adding more to our codebase than ever before. Itâs annoying because we then need to clean up that code later, extracting reusable elements, etc. I had to fight for hours with the team recently, that some reusable code wasnât actually reusable at all and needed a battle to prevent it going into our codebase.
https://gitclear-public.s3.us-west-2.amazonaws.com/Coding-on-Copilot-2024-Developer-Research.pdf
The shift towards a more transient, less thoughtful coding style not only risks diluting the quality of our repositories but also undermines the craftsmanship that defines great software developmentâ. Iâm not worried about losing my job to AI. Iâm worried that there wonât be any quality software developers left in the field if this continues.
The allure of copy-paste
The copy-paste life. You find the code you want from Stack Overflow or through your favorite AI and whack it into the codebase. The developer gets a dopamine hit from developing the feature and all is well.
Developers love creating new features, but that copy-pasted code often persists long past its expiration date. Is there anyone on your team with the authority to remove duplicate code? Unfortunately, in mine we do not have the culture for removing duplicate code and our codebase is suffering as a result.
I think itâs not just a tech debt issue, itâs a cultural issue too.
Curing the âfire and forgetâ developer
Putting that code into the codebase needs steely habits and a pinch of education. Rather than training AI to make âit dependsâ decisions we can get developers of a higher standard.
I donât mean rush a training program for developers, I mean develop a BOK and hold software developers accountable for their knowledge and performance. We need teams who understand the strategy that will produce maintainable code and the intelligence to solve problems in a quality way.
Then our senior developers will not need to invest so much time and effort in understanding poor code, and difficulties in maintaining that code. How about that?
Conclusion
As we navigate this AI-powered future, letâs not lose sight of the principles that have long guided good software development: clarity, maintainability, and, above all, a commitment to quality. The journey ahead may be paved with AI, but itâs the human touch that will ensure we reach our destination without compromising the integrity of our craftââ.