When you delete a block of code that you thought was useless
cross-posted from: https://piefed.world/c/shit/p/1220170/when-you-delete-a-block-of-code-that-you-thought-was-useless
::: spoiler GIF Mirrors
107
Comments4cross-posted from: https://piefed.world/c/shit/p/1220170/when-you-delete-a-block-of-code-that-you-thought-was-useless
::: spoiler GIF Mirrors
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.
Oof, just did that a couple of days ago, in prod no less (not able to test particular change in lower envs). Good times.
That's why we comment first, then use version controls. Also we never test in prod.
ROFL yeah right!
Fortunately: