this post was submitted on 25 Jun 2026
183 points (100.0% liked)

Programmer Humor

31975 readers
903 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 3 years ago
MODERATORS
top 5 comments
sorted by: hot top controversial new old
[–] Quetzalcutlass@lemmy.world 15 points 23 hours ago (1 children)

This is why I love the "find usages" inspection, though the IDE (at least JetBrains ones) will usually preemptively warn you about unused methods and functions.

If it's a block of logic in the middle of a function that you suspect is no longer needed, set a breakpoint in it and run the program before deleting it just to make sure it's not being triggered.

[–] ryannathans@aussie.zone 13 points 20 hours ago

Deeper down the rabbit hole, more dangerous "useless" blocks of code won't be found with "find usages" because the usage either:

  1. isn't in the project, and is external. Like a powershell script calling a function present in the DLL, or your system's equivalent. Or even hardware accessing it directly at a known address, like an IRQ table

  2. is accessed via reflection, which the IDE won't know about

  3. for bonus points, the linker depends on it to make a functioning binary. Or some other dodgy code may break at runtime if offset from its original location in the binary..

[–] Omega_Jimes@lemmy.ca 8 points 22 hours ago

That's why we comment first, then use version controls. Also we never test in prod.

ROFL yeah right!

[–] akunohana@piefed.blahaj.zone 6 points 23 hours ago

Fortunately:

  1. I quit the editor without saving the changes
  2. I have a previous version that still contains the block in question
  3. I have a few onions on which I can blame my tears
[–] Hayduke@lemmy.world 4 points 22 hours ago

Oof, just did that a couple of days ago, in prod no less (not able to test particular change in lower envs). Good times.