this post was submitted on 29 Jan 2026
695 points (98.3% liked)

Programmer Humor

28973 readers
1519 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Guttural@jlai.lu 8 points 14 hours ago

As soon as I stopped trying to write textbook OOP stuff, this stopped occurring to me. That was years ago.

I'm not saying I write perfect code, no. But when I read bad stuff I wrote, I can understand and it and think of ideas about how to improve it if that becomes necessary.

On top of writing more functional-style code, the way I achieved this was:

  • Absolutely no inheritance whatsoever. Composition + interfaces work wonders for what I do.
  • Minimal mutable state. This pays dividends when debugging.
  • Ditto for type-system-encoded nullability markers (ie. ? in C#, std::optional in C++...)
  • I avoid writing code just-in-case something happens. If I haven't run it manually or via unit tests, it goes to the garbage bin (not an absolute, just a guiding principle). There's a chance that code isn't even correct to begin with and you'll have to throw it away should you ever need it.
  • Low indirection. I don't want to jump through 10 functions to see what something is doing, and nobody else does either.