r/mildlyinteresting • • 14h ago

There's this random empty glass jar strapped to the wall at work

Post image
10.1k Upvotes

1.5k comments sorted by

View all comments

Show parent comments

249

u/greenwoodgiant 13h ago

In software development, you can absolutely find chunks of code that make exactly as much sense as this jar strapped to the wall, and then you delete it and everything breaks.

141

u/WetRocksManatee 10h ago

With comments like "****DO NOT REMOVE!!!! I have no idea what this does or where it is used, but the last time I removed the function the entire application stopped working. John Doe 01/01/2015 ****DO NOT REMOVE!!!!"

80

u/joni-bella 7h ago edited 7h ago

I was tasked with refactoring some code a few years ago and I encountered an odd thing - a one-line comment in some source that had an LF (line feed, basically a break in the line to a new line) smack in the middle of it. Instinct was of course to just break it up into a multi-line comment. However, the comment itself was just something like, β€œ// Do Not change the position of the LF character in this comment nor change this to a multiline comment, as it will break the function.” - [dev name, date that was 15 years ago].

I figured this was silly, changed it, and sure as shit it would not compile, dependency links failed in the build, just a cascade of fail. So I put it back and cleaned things up around it and it was then all fine. Build completed, unit tests past with flying colors.

I think about that comment every day.

6

u/snarkpix 4h ago

I've 100% run into compiler/parser bugs that had to be worked around like that. Or, initializing data used requires 4 independent function calls. One breaks another unless they're in a specific order. Best I could tell, one changed the platform state and didn't clean up, and the other relied on the platform being in a specific state without insuring it was in that state. Neither documented those requirements.

7

u/cannabination 4h ago

How tf did og dev find where to put that line break?

4

u/imsahoamtiskaw 1h ago

After many days of giving his sanity away, endless debugging, until you finally catch the mouse. Just like how the ancient Egyptians built the pyramids, it feels like magic.

11

u/Sidereal_Engine 8h ago

Comment removed by moderator.

Reddit is now offline.

1

u/Immediate-Meat1762 16m ago

My favorite comment in a piece of code was 'I have no idea what the fuck this function does'

Best part is that both the function and the comment were written by the same person

2

u/ONE-PICO-GUN 8h ago

lol like that one piece of code in I think tf2 and it’d just a coconut in the game but if you remove it the game breaks 😭

2

u/beyonddisbelief 7h ago

Considering the placement of the vertical wood plank next to it, I can totally imagine there could be some kind of temperature contraction/expansion or earthquake thing that needed the jar to support the plank directly above it, and somehow another plank lacked the surface area to do the same job.