this post was submitted on 02 Oct 2024
593 points (96.4% liked)

Programmer Humor

19331 readers
19 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 19 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I dislike the .not() method a bit because it inverts the meaning of the previous code snippet you've read.

if (list.isEmpty()...

"Ah, so if the list is empty..."

if (list.isEmpty().not())

"Goddammit"

[โ€“] [email protected] 7 points 2 weeks ago

For me, it's pretty much the opposite. With the exclamation mark, I'll see the inversion, then I'll read the actual condition and try to make sense of it, and then I'll remember that this thing was supposed to be inverted. Or I won't remember, that's unfortunately also a possibility.

Might just be what we're used to, though. I have been working in a codebase with mostly .not() for the past year.