SHOCKINGđŸ€Ż. AI Destroys Code Quality

Photo by Jeff Kingma on Unsplash

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​​.

Previous
Previous

Gaming Companies Confuse Coders for Campersâ›ș

Next
Next

Should You Study AI Engineering to AI-Proof Your Future?