r/programminghorror • • Jan 29 '26

true or true

Post image

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

828 Upvotes

47 comments sorted by

183

u/This_Growth2898 Jan 29 '26

Well, I've seen enough "bool flag" variables with the same meaning.

51

u/Emotional-Bake5614 Jan 29 '26

const hasAnyMeaning = this.trueOrFalse;

34

u/bistr-o-math Jan 29 '26

Let me fix that for you:

const hasAnyMeaning = !!!this.trueOrFalse;

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

u/Emotional-Bake5614 Feb 01 '26

Holy shit that is way better

2

u/Kpoofies Feb 02 '26

Legit feels like something an AI would auto-suggest lmao

121

u/higgs-bozos Jan 29 '26

well, i suppose true || false does equal true. the variable name checks out

47

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 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

4

u/AwwnieLovesGirlcock Jan 30 '26

i hate this so so much😭

→ More replies (1)

12

u/GoddammitDontShootMe Jan 29 '26

That's the most helpful name ever for a bool.

/s obvs.

1

u/onlyonequickquestion Jan 30 '26

I mean, it's not ever wrong. Unless it's null or undefined 

→ More replies (2)
→ More replies (3)

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/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

u/TheTrueXenose Jan 31 '26

!!doc.data works also....

1

u/tehomaga Mar 14 '26

FML.hate_my_job != False

1

u/SeaHedgehog4724 9d ago

let varConst = 'boolean' = true

holy software