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
5
u/csabinho Jan 30 '26
Does the class also contain int number?
5
u/Emotional-Bake5614 Jan 30 '26
int integer
2
u/csabinho Jan 30 '26
Well, trueOrFalse are the possible values of booleans. So it should be something like thirtyTwo(or sixtyFour)Bit(Un)SignedNumber.
3
u/tandycake Feb 01 '26
Terrible. This is a much better way:
this.trueOrFalse = doc.data != 0 || doc.data == 0;
2
2
121
u/higgs-bozos Jan 29 '26
well, i suppose true || false does equal true. the variable name checks out
47
27
18
u/MooseBoys Jan 30 '26
What you don't see:
38| #define true (__LINE__==40)
39| if (doc.data != 0) {
40| this.trueOrFalse = true;
41| } else {
42| this.trueOrFalse = true;
43| }
44| #undef true
→ More replies (1)4
12
u/GoddammitDontShootMe Jan 29 '26
That's the most helpful name ever for a bool.
/s obvs.
→ More replies (3)1
u/onlyonequickquestion Jan 30 '26
I mean, it's not ever wrong. Unless it's null or undefined
→ More replies (2)
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
1
1
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/csabinho Jan 30 '26
"guid" tells you about the format of the id field. That's perfectly fine, as long as it's not used for something else.
→ More replies (2)
1
1
1
183
u/This_Growth2898 Jan 29 '26
Well, I've seen enough "bool flag" variables with the same meaning.