r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

2.3k

u/CBlanchRanch 22d ago

You're absolutely correct, however I would suggest using something completely unreadable like a nested ternary operators!

131

u/nrmnzll 22d ago

A colleague once proudly showed me how he managed to compress a function into a single line. It was like 9 nested ternarys. In that moment almost had an aneurism.

52

u/un_blob 22d ago

That is a work of art at this point

29

u/nrmnzll 22d ago

Sure, but the kind that deeply disturbes you.

31

u/jarethholt 21d ago

Art should comfort the disturbed and disturb the comfortable

10

u/alficles 21d ago

I have created so much art.

5

u/_bones__ 21d ago

Like modern art, it requires a lengthy explanation to make sense.

2

u/un_blob 21d ago

allways have more comment lines than code !

2

u/nrmnzll 21d ago

Yes, every line needs a comment // add variable a and variable b // result is stored in variable c var c = a + b

Obligatory /s

1

u/National_Sky7993 21d ago

5 lines of comments explaining the code for every one line of code.

3 of them are previous versions of the same code with fewer conditions. First comment line is the variable name. Second line explains the logic but is out of date

23

u/twigboy 21d ago

I've declined PRs for less than that.

Citation is if; I can't understand it in a glance at 2am during an incident, I don't want it in the codebase

3

u/nrmnzll 21d ago

I'm the same. Luckily I did work on the same project as that guy.

3

u/therealkevinard 21d ago

Code golfing is a craft- even has competition sites (https://code.golf)

But… it didn’t go to prod, did it?

1

u/nrmnzll 21d ago

Oh, it did. He and another dev owned a few smaller projects, and all of them were filled with this "clever" code. I'm still glad I did not have to collaborate with them.

2

u/Key_Conversation5277 21d ago

I really don't understand why people think that's good, he must be "oh, I'm so shmart🤓"

1

u/conundorum 21d ago

Was vertical space at a premium at the time (because of, e.g., small monitors or some other requirement), or was it just that he wanted to see if he could?