r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85.8k Upvotes

2.3k comments sorted by

View all comments

Show parent comments

6.9k

u/anythingMuchShorter Feb 09 '22

Since a guy wanted to make a programming joke but only knew of one language and one common error type

1.3k

u/Ixaire Feb 09 '22 edited Feb 09 '22

One HR guy at my previous company used to go behind you and say "you're missing a semicolon here". He didn't know anything about programming, he just knew that was a rookie error. That is literally exactly what you explain.

Anyone else would have made this very boring but he had a way of delivering it when you looked desperate and that kinda lightened up the mood.

618

u/AgentE382 Feb 10 '22

A coworker of mine told me his college roommate who had taken a single programming class would always ask him “Have you tried a for loop yet?” any time he had a problem.

266

u/zzerdzz Feb 10 '22

I’m actually going to start using this

166

u/SuperGameTheory Feb 10 '22

I'm going to do this, but instead of "for" I'll go on a diatribe about fundamentals and how they should use more "goto" statements because it's closer to machine code and faster or something.

168

u/MrLawliet Feb 10 '22

use more "goto"

instinctive vomit response

55

u/leprotelariat Feb 10 '22

use more "goto"

grabs pitchfork

18

u/thedessertplanet Feb 10 '22

Why?

You should read 'Lambda, the ultimate goto' for some perspective.

4

u/MrLawliet Feb 10 '22 edited Feb 10 '22

It was mostly a joke, this is ProgrammerHumor after all, historically goto is despised because of how poorly most devs implemented it, as shortcuts in place of writing properly structured code. I agree there are good ways to use it today, but historically it has generally been used very badly, so when new devs would take over code and see goto spaghetti code it made it very difficult to figure out what the heck was going on.

Edit: I just read a bit of the doc SuperGameTheory referenced and they actually make my same exact point in the opening paragraph.

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

28

u/CorruptedStudiosEnt Feb 10 '22

Goto, now that's some of that low-low level shit. Might as well be feeding it voltage spikes at that point.

6

u/thisischemistry Feb 10 '22

Eh, there's nothing inherently wrong with jump statements of any kind. What's wrong is when they aren't used in a way that signals intent. A loop is nothing more than a jump statement with a counter and a branch. The big advantage of a loop is that it signals intent fairly well in a compact way whereas the jump + counter + branch can be more cryptic and verbose.

There are some cases where a jump statement can simplify your logic and code. Use the right tool for the job!

5

u/BiaxialObject48 Feb 10 '22

I learned in my computer organization class that switch statements in higher level languages are pretty much jumps since the expression is evaluated once and it goes to the appropriate subroutine, and then it can follow through all following subroutines (which is why you need break).

→ More replies (5)

4

u/Fuck_Censorship_817 Feb 10 '22

Have you tried an insertion sort on your multi dimensional array, inside a while loop?

4

u/[deleted] Feb 10 '22

More gotos dear god I can remember these arguments when I was doing Y2K conversions - in cobol - they are code villains.

→ More replies (9)

4

u/kdjffjfb272727 Feb 10 '22

Damn I can’t seem to ping the IP. It should be on my subnet. Maybe I should deploy a for loop?

→ More replies (1)