97365ffd-3cc8-44df-af8a-e5bd49f6bd68

I reject AI code even when it works — and you should too

Working code isn't enough. We need to understand it.

Nina Johansson||Source: Hacker News
I reject AI code even when it works — and you should too
Photo by Google DeepMind on Pexels

I reject AI code. Even when it works. Even when it passes all tests. Even when it's faster than anything I could write in an afternoon.

This isn't Luddism. I use AI tools daily. Copilot lives in my editor. ChatGPT has saved me from countless Stack Overflow rabbit holes. But when a developer submits AI-generated code to my pull request, I look at it with a different set of eyes — and often, I send it back.

Working code is table stakes

The argument I hear most: "But it works. The tests pass. What's the problem?"

The problem is that code isn't just a set of instructions for a machine. It's a communication artifact. It tells the next developer — who could be you, six months from now — what the hell is going on. And AI-generated code, for all its syntactic correctness, often fails at that second job.

AI writes code like a student who memorized the answer key but skipped every lecture on why the answers work.

I reviewed a PR last week where the developer had asked ChatGPT to optimize a database query. The AI produced a five-line monster with subqueries and window functions. It ran 40% faster. It was also completely inscrutable. No comments. No explanation of the logic. Just raw, efficient, opaque SQL.

When I asked the developer to explain it, he couldn't. He'd copy-pasted, run the tests, and moved on. That's not engineering. That's cargo cult programming.

Understanding matters more than speed

I've been doing this for fifteen years. I've shipped code that I'm ashamed of. I've also fixed bugs in systems where the original author was long gone, and the code was so tangled that I wanted to cry. The difference between that nightmare and a maintainable codebase? Clarity. Intent. A trail of understanding.

AI doesn't provide that trail. It provides an end result, but no breadcrumbs. When you use AI code without internalizing it, you're creating technical debt that will compound with interest. The next person to touch that code won't just have to understand the problem — they'll have to reverse-engineer the AI's reasoning.

And let's be honest: the AI didn't reason. It pattern-matched. It guessed. It produced the most statistically likely sequence of tokens. That's not the same as solving a problem.

The hidden cost of accepted AI code

Every piece of code you accept without understanding adds a tax. A mental load. A future bill.

Consider security. AI models are trained on public code, which means they've absorbed every bad practice, every vulnerability, every shortcut. A recent study found that AI-generated code contained security flaws 40% of the time. Not because the AI is malicious, but because it's an average of everything it's seen — and the average public codebase is a horror show.

Consider edge cases. AI doesn't know your system. It doesn't know that your deployment pipeline has a quirk with time zones. It doesn't know that the API you're calling returns null on Tuesdays. It writes for the general case. The general case doesn't exist in production.

Consider debugging. When AI code breaks, you can't ask it why. You can't say, "What were you thinking here?" You're left with a black box and a stack trace. Good luck.

How I use AI without losing my soul

I'm not saying throw the AI out. I'm saying treat it like a junior developer — one who writes fast but needs constant review.

Here's my rule: if I use AI to generate code, I must understand every line before I commit. Every. Single. Line. If I can't explain why it works, I don't ship it. I rewrite it until I can.

This means I use AI for boilerplate. For scaffolding. For generating test cases. For suggesting approaches I hadn't considered. But I never use it as a crutch to skip the hard part — the part where I actually have to think.

I've seen developers paste a stack trace into ChatGPT, get a fix, apply it, and call it done. That's not learning. That's delegating your judgment. And if you delegate your judgment long enough, you lose it.

The real danger is in the collective

It's easy to say, "I know what I'm doing, I can spot bad AI code." But what happens when an entire generation of developers grows up with AI as their primary teacher? What happens when the ability to write code without AI atrophies?

We're already seeing it. Junior developers who can't debug without copilot. Senior developers who trust AI output because it's "usually right." A culture where shipping fast matters more than understanding deeply.

I don't want to work in that world. And I don't think you do either.

The verdict

Rejecting working code feels counterintuitive. It feels arrogant. But it's not about the code. It's about the craft. It's about taking responsibility for what you ship. It's about being able to stand behind every line and say, "Yes, I own this. I understand it. I can fix it at 3 AM when it breaks."

AI is a tool. A powerful one. But tools don't replace judgment. They amplify it — or they erode it.

Choose wisely.

Advertisement
#ai-code-generation#code-review#software-craftsmanship#technical-debt
分享到:XfWB