r/ProgrammerHumor • • Jun 06 '20

It's the law!

Post image
38k Upvotes

1.1k comments sorted by

View all comments

356

u/[deleted] Jun 06 '20

Programmers: name of variable should be self explaining what variable is for

Also programmers: use i,j,x,y,z variables.

0

u/[deleted] Jun 06 '20

[deleted] — view deleted comment

174

u/UlisesNc5 Jun 06 '20

IMO iand j are self explaining. If you see an i, you should know it's an iterator. If you see a j, it means you missed seeing the i.

this is the funniest shit i ever heard

39

u/su5 Jun 06 '20

Which is why I name my variables i,k and m

29

u/rtkwe Jun 06 '20

Like letting loose 3 pigs number 1,2, and 4.

0

u/[deleted] Jun 06 '20

[deleted] — view deleted comment

3

u/2ply4dayz Jun 06 '20

That prank's so old nowadays kids really release 12 pigs. Faculty think they're good after finding 11 and reopen with one still on the loose.

→ More replies (1)
→ More replies (1)
→ More replies (1)

26

u/microbit262 Jun 06 '20

If you see a j, it means you missed seeing the i.

and if there is a k, you missed the j, if there is a l you missed the k and so on.

11

u/Pixilatedlemon Jun 06 '20

Just wait until they hear about ‘x’

→ More replies (25)

179

u/Caenir Jun 06 '20

I and j are so commonly used they are self explaining

129

u/evil_cryptarch Jun 06 '20

As are x, y, and z if you're working with cartesian coordinates.

0

u/[deleted] Jun 06 '20

[deleted] — view deleted comment

20

u/MattTheGr8 Jun 06 '20

I semi-learned quats a couple of months ago... as far as I can tell, they are pure voodoo.

9

u/purebuu Jun 06 '20

I always just accepted that quaternions are a way to encode a more complex rotation matrix into fewer numbers, that still has similar mathematical properties when you add/multiply them together. I know theres a more ingrained reason behind them but I've never needed to delve that deep.

3

u/[deleted] Jun 29 '20

A little late, but here's a nice overview over quaternions and how they arise from bivectors.

→ More replies (1)

8

u/Daedagon Jun 06 '20 edited Jun 06 '20

I prefer i,j,k,r myself.

And what isn't self-explaining about using the 3D projection of a 4 dimensional unit hypersphere, being rotated by two separate 2D perpendicular rotations simultaneously. Easy-peasy...

-edit-

I've been trying to fully grasp quaternions for a few years now and still find them mind-fucky to visualise.

Here's a great video to help understand them: https://www.youtube.com/watch?v=d4EgbgTm0Bg

I'd seriously recommend 3Blue1Brown's channel for anyone interested in maths in general.

5

u/[deleted] Jun 06 '20

Guards, seize this sorcerer and throw him into the dungeon at once!

4

u/Daedagon Jun 06 '20

All I had to do was sell my soul to our 4 dimensional overlords to gain this knowledge.

J̸̵̡̡̪̻͎̪͕͙̟̘͚͓̓̈́͛͐̔͐o̸̴̡̞͚̙͕̠̪̙͇͎̠̙̔̈́͛̔͘͠i̴̵͎̝͖͔̫͎͖͍̪̠͕̿́̒̒̽̈́n̵̴̡̢͕͔͎̙̦͖̝̘͍͆̿͋͊͘͝ U̸̴̢̦̻̠̼͇͔̪̠̝͊̓̽͘̚͝s̸̵̡̼͇͖̫̟̫͉͖̝̦̓̽̒͋͋͘

5

u/itmillerboy Jun 06 '20

Bruh what did I just stumble into? Way too high to be reading that kinda shit.

→ More replies (1)
→ More replies (7)

5

u/highfire666 Jun 06 '20

And T when you're working with temperature or period, but never both. In that case you use temp! Unless you already used temp for temporary variables

4

u/efreak2004 Jun 06 '20

No, temporary variables need to have a number after then so you can keep track. Otherwise you might accidentally set it again later without realizing it's already in use.

I recommend adding a GUID to the end of the variable name, to ensure it doesn't get reused.

4

u/highfire666 Jun 06 '20

Splendid idea, just have to create a hashmap with explanations of what each temp represents! In case someone reads through your code, they can simply write tempMap3.get("temp-<guid>") and receive a string like tempTemperature5

My colleagues will be exhilarated!

→ More replies (3)
→ More replies (3)
→ More replies (1)

38

u/Bobby_Bonsaimind Jun 06 '20

If you use x/y/z for loop variables and they have nothing to do with dimensions, I'm going to figure out where you live and I will nail a dead fish to your doorstep.

→ More replies (17)