Yik Yak icon
Join communities on Yik Yak Download
My teammate dead ass removed my one liner for this in our group project ….
165 upvotes, 17 comments. Yik Yak image post by Anonymous in Computer Science. "My teammate dead ass removed my one liner for this in our group project …."
upvote 165 downvote

default user profile icon
Anonymous 3d

Revert his changed yours is better and more readable, because his is 5x as long for the same logic

upvote 23 downvote
default user profile icon
Anonymous 3d

I could see a reason being legibility, but also fuck teammates that don’t communicate.

upvote 17 downvote
default user profile icon
Anonymous 3d

😂😂

upvote 6 downvote
default user profile icon
Anonymous 3d

Wouldn’t rand # & mod combo compile faster than nextBoolean?

upvote 6 downvote
default user profile icon
Anonymous 3d

Crash out

upvote 5 downvote
default user profile icon
Anonymous 1d

Something I like doing is splitting the ternary operator over multiple lines. Best of both worlds. Like this: return random.nextBoolean() ? a : b;

upvote 4 downvote
default user profile icon
Anonymous 3d

was there any justification?

upvote 3 downvote
default user profile icon
Anonymous 3d

Didn’t even omit the else block 💔💔

upvote 3 downvote
default user profile icon
Anonymous 3d

His is more quickly understandable

upvote 1 downvote
default user profile icon
Anonymous 3d

The first line isn’t even that hard to understand and is a lot cleaner. Your teammate is crazy

upvote 1 downvote
default user profile icon
Anonymous replying to -> #2 3d

He didn’t see it he said

upvote 9 downvote
default user profile icon
Anonymous replying to -> OP 3d

Uh huh

upvote 4 downvote
default user profile icon
Anonymous replying to -> #6 3d

I guess but who’s doesn’t know how to read ternary operators ?

upvote 2 downvote
default user profile icon
Anonymous replying to -> #6 3d

No it's not, maybe if you're a sophomore, but anyone who is more than a novice coder can tell what a ternary expression is at a glance, and it has way less cognitive load to read and process than something 5 lines longer

upvote 6 downvote
default user profile icon
Anonymous replying to -> #6 3d

Now nesting ternary expressions gets hairy and hard to read fast, but one like this is almost always more readable than the long form. Especially when all the expressions involved are this short

upvote 13 downvote
default user profile icon
Anonymous replying to -> #7 3d

already did

upvote 11 downvote
default user profile icon
Anonymous replying to -> #6 3d

The one liner is way quicker to read. I don’t think we should stop using ternary operators just because some people are too lazy to understand what they mean even though it’s ridiculously simple

upvote 4 downvote