Measuring the sloppiness of code

269 points · 229 comments on HN · read original →

Points and comments are a snapshot, not live.

LLM-generated code is formally correct but often sloppy, accumulating unnecessary complexity.

The article proposes metrics to quantify code sloppiness: verbosity (duplicated/unnecessary lines) and erosion (mass concentrated in complex functions). Data from SlopCodeBench shows agent-generated code is roughly twice as verbose and eroded as human-written code (verbosity 0.33 vs 0.15; erosion 0.68 vs 0.31). Iterative coding benchmarks reveal even state-of-the-art models achieve 0% pass rate on strict checkpoints as bad decisions accumulate. The author argues that AI-as-judge evaluations are unreliable, and human intuition remains essential for assessing code quality.

What commenters are saying

Commenters broadly agree that measuring code quality is important. Some argue that current metrics (LOC, cyclomatic complexity) are tractable proxies for what developers already intuitively notice. Others counter that code quality is isomorphic to the halting problem and thus intractable. A split emerges: some believe AI slop is a temporary gap in reward functions that will be closed once better metrics exist, while others insist human understanding and judgment remain essential, especially for production systems. Several note that pre-LLM enterprise code was often already sloppy, and that blaming workers ignores management pressures.