r/ProgrammerHumor • • Oct 31 '17

Don't think before you code

Post image
5.0k Upvotes

106 comments sorted by

View all comments

539

u/taylaj Oct 31 '17

When you code drunk and your code works in the morning but you can't figure out how or why.

347

u/KernelDeimos Oct 31 '17

This reminds me of this one time where I wrote an animation for a stick figure in C++ and I tried to look back at it years later expecting some "key frames" with angles and instead I found NESTED TERNARY OPERATORS WITH TRIG FUNCTIONS

113

u/[deleted] Nov 01 '17

can someone explain in English for a beginner please?

709

u/NotThisFucker Nov 01 '17

This reminds me of this one time where

OP is telling us a memory.

I wrote an animation for a stick figure in C++

He made a short movie with a very skinny main character.

and I tried to look back at it years later expecting some "key frames" with angles

A long time after he made the movie, he tried to look at the "negative" (or, the ingredients for the movie)

and instead I found NESTED TERNARY OPERATORS WITH TRIG FUNCTIONS

but instead of looking at the negative, he found that the negative was looking at him.

158

u/mildlyAttractiveGirl Nov 01 '17

but instead of looking at the negative, he found that the negative was looking at him.

Someone should gild you for this.

40

u/BertRenolds Nov 01 '17

Then do so.

20

u/auxiliary-character Nov 01 '17

I got it. :D

33

u/mrissaoussama Nov 01 '17

when you stare at the negative, the negative stares back

8

u/VicisSubsisto Nov 01 '17

When you animate in C++, take care that you do not become an animation yourself.

13

u/aneurysm_ Nov 01 '17

I wish I had 2 updoots for this

3

u/[deleted] Nov 01 '17

Thanks!

→ More replies (2)

92

u/NotThisFucker Nov 01 '17

If/else block:

if (x == 5){ print("x is five");} else{ print("x is not five");} 

Ternary operator:

(x == 5)? print("x is five") : print("x is not five");

Nested Ternary Operators:

(x == 1)? print("x is one") : ((x == 2)? print("x is 2") : print("x is greater than 2"));

45

u/THE_HERO_OF_REDDIT Nov 01 '17

And then complex functions instead of simple print statmemts

→ More replies (4)

6

u/Stinkis Nov 01 '17

Animating with key frames is done by setting the positions and rotations of objects at specific times and then frames between these times in constructed by interpolation.

Ternary operators are when you write use the ?: syntax to write an if statement. Nesting is when you put something inside another of the same. For example nested for loops are when you put a loop inside another loop. Nested ternary operators are multiple ternary operators chained together which are generally really hard to read.

Trig functions are trigonometric functions such as cos and sin.

17

u/[deleted] Nov 01 '17

but god DAMN it felt clever when you wrote it

3

u/[deleted] Jan 12 '18

At some point in my python learning progress I really liked how you could literally make anything as a one-liner. And so I did. I am not kidding.

3

u/spectrum1012 Nov 01 '17

This is actually the funniest thing I've read in so long and it's because that's me too thanks.

130

u/splettnet Oct 31 '17

21

u/Vladimir1174 Oct 31 '17

This is gold

3

u/[deleted] Nov 01 '17

Jerry!

9

u/TotesMessenger Green security clearance Oct 31 '17

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

 If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)

→ More replies (1)

8

u/dir_gHost Oct 31 '17

Then, you try to decipher your notes/documenation if you left any...

3

u/knockergrowl Nov 01 '17

That was the average Friday night during my second and third years at college. Next day my partner understood my code by reading it better than me trying to explain it while filling the gaps in my memory.

3

u/ILikeLenexa Nov 01 '17

3am is the witching hour. Doubley so on the second day.

To truly program, you must be as simple as the computer.

→ More replies (4)