DEV Community

TROJAN
TROJAN

Posted on

I Know My Code Is Bad Because I Start Defending It

There’s a moment when I know my code is bad. Not when tests fail. Not when something breaks. It’s when someone asks a simple question and I start explaining instead of pointing.

That’s the smell.

Good code doesn’t need a defense. Bad code comes with context, history, and a quiet “don’t touch that part.” At that point, you’re not documenting. You’re apologizing.

I’ve noticed when code is clear, I’m calm. When it’s messy, I get defensive. I say things like “it works” or “we’ll clean it later.” Those aren’t explanations. They’re excuses.

Now I use one test. If I came back to this code in a few months, would I trust myself touching it without fear? If not, it’s not done. It’s just shipped.

What’s the best excuse you’ve ever made for bad code?

Top comments (0)