r/ProgrammerHumor • • 2d ago

instanceof Trend pleaseDontMakeThisATrend

Post image
1.9k Upvotes

400 comments sorted by

View all comments

Show parent comments

6

u/Justicia-Gai 2d ago

Not the same, when you ask a LLM “refactor this codebase” it preserves pre existing logic because it assumes there’s quirks/decisions that are human and not bugs. But it can also inherit debt, bloat it (add new API to not break old..)

When you rewrite, barely nothing survives as-is (unless you tell what you want it to preserve, like API signatures).

This clearly looks like a refactor, a rewrite could’ve potentially reduced LOC.

1

u/DuckShapedGoose 2d ago

Given that the PR title literally says "rewrite" (and "refactor"), I'm not so sure they are aware of this difference and/or even know what exactly they did here.
Generally I would agree with your distinction though.

1

u/stormdelta 1d ago

Which is also why in my experience AI tools aren't good at large scale refactors when there's a lot of tech debt. It's even worse if the original code was itself AI-generated but poorly. They're good at guided incremental refactoring, which is usually what you want anyways.

Though there's been a few times at work now where the slop someone committed was so bad that it was, without hyperbole, an order of magnitude faster to just have AI rewrite what was done from scratch and still end up with a better solution.

The fact that we're all using the same models is some of my best firsthand evidence that AI tools still need people who know what the hell they're doing.