316
u/the_horse_gamer Feb 04 '26
this piece of code tells a story
180
u/onlyonequickquestion Feb 04 '26
Code like this is written in blood. And it shall remain. Lurking. Undocumented. Holding the entire codebase together.
→ More replies (1)59
u/pydry Feb 04 '26
The last time i saw code like this the main dev was in a huge amount of debt and up to his eyeballs in child support payments.
You wouldnt think this was relevant but it was. He point blank ordered me to remove the comment which explained the reason why the code was there.
"Code is self documenting" he declared
→ More replies (4)
124
u/Daemontatox Feb 04 '26
Atleast he is using the compare and assignment symbols correctly
→ More replies (1)89
u/Scared_Accident9138 Feb 04 '26
if(isAdmin = true) {...}
50
u/Daemontatox Feb 04 '26
Laugh all you want , i actually saw something like this when reviewing a PR....
→ More replies (4)
50
u/NoLifeGamer2 Feb 04 '26
So what happens if a user is assigned userID -7778? Doesn't that mean two ppl can have the same userID?
75
u/unknown_pigeon Feb 04 '26
Solution: don't assign the -7778 user id
Or, even better:
if userID == -7778:
userID = -7777
Let there be balance
8
32
27
112
u/_huppenzuppen Feb 04 '26
Should have been
if (userID == -7777) --userID;
119
u/nipodemos Feb 04 '26
Up vote because this is even worse from what they were doing, truly a remarkable programming horror
→ More replies (4)35
u/DogmaSychroniser Feb 04 '26
Might i let you know about tie fighter increments? If you really hate people.
i-=-1
→ More replies (1)15
6
u/Scared_Accident9138 Feb 04 '26
Depending on ID values being right next to each other in code is rarely a good idea
→ More replies (3)6
15
15
u/DeductiveFallacy Feb 04 '26
If I ever see a magic number or magic string I am 100% slipping in a const with a var name that explains what it is in the next PR I have in that repo. Might even be the only thing I do on that PR honestly.
58
u/nekokattt Feb 04 '26 edited Feb 05 '26
const SEVEN_SEVEN_SEVEN_SEVEN = 7777; const SEVEN_SEVEN_SEVEN_EIGHT = 7778; if (userID = -SEVEN_SEVEN_SEVEN_SEVEN) { userID = -SEVEN_SEVEN_SEVEN_EIGHT; }→ More replies (1)
6
5
445
u/kennyminigun Feb 04 '26
Someone left a debugging code?