r/programminghorror • u/Emotional-Bake5614 • Jan 29 '26
true or true
this piece of perfection was found in the codebase that my gf used to work
don't know exactly what is the context here, but probably doc.data holds the info if the user has agreed with the cookies /s
826
Upvotes
183
u/This_Growth2898 Jan 29 '26
Well, I've seen enough "bool flag" variables with the same meaning.
5
u/csabinho Jan 30 '26
Does the class also contain int number?
3
u/tandycake Feb 01 '26
Terrible. This is a much better way:
121
u/higgs-bozos Jan 29 '26
well, i suppose
true || falsedoes equaltrue. the variable name checks out47
u/EvnClaire Jan 29 '26
this.trueOrFalse
27
u/Keio7000 Jan 29 '26
I would say I have more problems with the variable name
18
u/MooseBoys [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jan 30 '26
What you don't see:
12
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jan 29 '26
That's the most helpful name ever for a bool.
/s obvs.
2
u/Dependent_Union9285 Feb 02 '26
This looks like a debugging tool to me… I mean, not a terribly well designed one, but placing a single breakpoint on this method and then calling it where you want to makes going back to clean up your breakpoints a lot easier. And it can’t hurt anything, because OF COURSE this.trueOrFalse will NEVER be used for anything ever, I guarantee it. Thereby making this perfect.
/s
1
u/Ksetrajna108 Jan 29 '26
All I can say is, tyro!
1
u/Marmik_Emp37 Jan 29 '26
ðŸ˜ðŸ˜ðŸ˜
1
u/CARLO-from-HTW Jan 29 '26
I pick true
1
u/beefz0r Jan 30 '26
I've seen production scenarios where "guid" was the name of the field. As if that tells you something
1
u/TheTrueXenose Jan 31 '26
!!doc.data works also....
1
u/tehomaga Mar 14 '26
FML.hate_my_job != False
1
u/SeaHedgehog4724 Oct 19 '26
let varConst = 'boolean' = true
holy software
-3
u/mohragk Jan 30 '26
Don't store boolean values like this. It wil llead to bugs whenever you forget to set it, or reset it. Better is to create a function that returns a boolean.
-38
u/faultydesign Jan 29 '26
A unit test would catch this bug
0
u/[deleted] Feb 05 '26
[deleted] — view deleted comment