this post was submitted on 30 Jan 2025
717 points (98.0% liked)
Programmer Humor
20188 readers
1552 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I feel like the "we don't know what this function does" meme is kinda bad. There's no reason beyond maybe time crunch why you shouldn't be able to dissect exactly what it does.
Despite this, the notion of a load-bearing function is still very relevant. Yeah, sure, you know what it does, including all of the little edge case behaviors it has. But you can't at this time fully ascertain what's calling it, and how all the callers have become dependant on all the little idiosyncracies that will break if you refactor it to something more sensible.
It has been several times now where a part of my system of legacy code broke in some novel fantastic way, because two wrongs were cancelling out and then I fixed only one of them.
https://en.wikipedia.org/wiki/Fast_inverse_square_root
even if you can figure out specifically WHAT a function does, it's not always clear WHY a function does, and honestly, if this function wasnt labeled in the code, no way in hell would I know what it does.
It has an entire wiki page dedicated to explaining it, and it involves enough math that most people wouldn't be able to follow along.
Nothing this atrocious lives in any current codebases I work on... but if you work at an old enough company, some of the load-bearing code will be tricky to figure out what is calling it, but also it was written in a time where little hacks were needed to eke out performance.
You only have to experience it once for it to be a memorable enough thing that you will cite it for the rest of your days.
Or more realistically, it IS comprehensible, but the level of effort necessary to comprehend it is not worth it. So you leave it as "undecipherable" and move on.
Usually it's mysterious business logic from before the dawn fo time.
Before January 1, 1970?
Exactly.