With the reach of generative AI, the term “slop” has risen in prominence. It represents a rejection of thoughtless content, often perceived to be low in quality or creativity.
Developers have always taken a view about the amount of effort they put in to a task - with a direct effect on the quality of code they deliver. This is a calculation based on deadlines, availability, resources, reputation, and plenty of other factors.
Opinion is strongly divided about AI-assisted coding. Some argue it supports increased productivity. Others cite poor quality outputs and unexpectedly high cost.
What does poor quality code look like?
I have been exploring the outputs from some generative AI coding tools. Some traits are pretty clear:
-
Use of obscure and made-up terms
-
Code mingled with narrative comments
-
Spaghetti code
-
Long or difficult to read functions
-
Inflexible, hard-coded assumptions
-
Dependencies on old libraries, difficult to upgrade
These issues are also referred to as technical debt.
Does it even matter?
Arguably, if code is only ever to be written by one person (or agent), then idiosyncrasies don't matter. Provided the developer knows where everything is, who cares if nobody else can figure it out? This may well be a naive position...
- Do you trust your coding agent to get everything right?
- What happens when you run out of credit?
- Do you want to be able to maintain it yourself?
- Are you sure nobody else will look at the code?
What can we do about it?
Over time, technical debt builds up in every project and the solution is to refactor the code - a sense-making process in which developers rewrite the offending parts. Solo developers and small teams working in isolation are particularly vulnerable to technical debt, but all teams experience it.
Running code reviews and writing code that any person can quickly understand is a good preventative measure. Some examples of established practices:
-
Clear and meaningful variable names
-
Use of well established design patterns
-
Use of existing frameworks, rather than re-inventing the wheel
-
DRY (Don’t Repeat Yourself)
-
KISS (Keep It Simple Stupid)
-
YAGNI (You Ain’t Gonna Need It)
-
SOLID (principles for object oriented development)
-
Separation of concerns (a precursor to the Single Responsibility Principle)
-
Clean Code (and opinionated superset of principles and approaches)
How are coding agents any different?
Coding assistants work alone. They aren't trained to expect code review nor do they have code quality metrics. As they work, they develop personal shorthand and assumptions, which then shapes and styles the code they produce.
I have been collating a set of guidance, skills, and scripts for coding assistants, to raise the quality of their outputs. It's available here: instantiator/dev-qual
For this topic, we’ll discuss factors that contribute to code quality, and how they can be measured and applied - both to AI-assisted and human developed coding. With some metrics in hand, I’ll support you to compose rules for your language or framework of choice, or enhance those already found in dev-qual.