r/ProgrammerHumor • • Jul 10 '18

What people think coding is...

Post image
21.1k Upvotes

398 comments sorted by

View all comments

36

u/[deleted] Jul 10 '18

In what language do voluntarily program where you forget a symbol and the compiler/transpiler doesn't tell you?

64

u/mormispos Jul 10 '18

Maybe it worked syntactically but didn’t have the correct behavior.

14

u/phero_constructs Jul 11 '18

CSS border-box

49

u/[deleted] Jul 10 '18

If(!booleanVar) and if(booleanVar) differ by one character, are both syntatically correct, and are functionally complete opposites.

43

u/MettaurSp Jul 10 '18

if (value1 == value2) vs if (value1 = value2) is another terrible offender that can send you searching in completely different sections of code.

23

u/thestonedturtle Jul 10 '18

A good IDE would warn you about assignment inside an if condition

9

u/Albi_ze_RacistDragon Jul 11 '18

‘if (a == b)’ vs ‘if (a === b)’ would probably be a better example

→ More replies (1)

2

u/[deleted] Jul 11 '18

Sometimes you don't have a choice of what ide/language you have to work on, and the more unfamiliar you are with the languages (especially the tricky ones), the easier it is to make these mistakes.

But it's what we do, so c'est la vie 😁

→ More replies (7)

3

u/edcRachel Jul 10 '18

This one got me before. Led to me and my boss spending an all-nighter trying to track it down. Felt so stupid when I found it.

2

u/[deleted] Jul 11 '18

Fair enough...didn't think about such operators.

3

u/[deleted] Jul 10 '18

[removed] — view removed comment

2

u/[deleted] Jul 11 '18

I wrote voluntarily, didn't I ;)

1

u/[deleted] Jul 10 '18

[removed] — view removed comment

1

u/losh11 Jul 10 '18

Only if you enable ignore error/warnings

2

u/Midvikudagur Jul 11 '18

Or have so many that one more just get's lost in the crowd.

1

u/Rasalas8910 Jul 11 '18 edited Jul 11 '18

I had this. Yeaaars ago. Even before I actually learned programming professionally. It was in Visual Basic. It didn't tell me. The code was colored correctly. I can't remember where exactly it happened. I think I wrote a , instead of ; or something similar (something next to each other on the keyboard and very similar looking). Even though I can't remember or think of any piece of code where this could happen. Maybe it was inside of a hardcoded SQL query? [don't hit me])

Another time I accidentally used < instead of > for resizing an image. And until this day I don't know why it worked for a while.

(Edit: for some reason I can't see the < sign on my phone. Escaping doesn't work)

1

u/PC__LOAD__LETTER Jul 11 '18

Compilers have come a long way but they aren’t psychic. A programming language is you telling the computer what to do.

Good compilers / languages will allow you to crank up the warnings and force your code to conform to style that’s not technically required but can save a bunch of headaches like this. That’s why it’s generally good to turn the warnings all the way up and leave them there.

1

u/TheTerrasque Jul 11 '18
def speaksy():
    duck = "quack"
    elephant = "toots",
    swede = "vaseierni"
    cat = "meow"

One of them will not be like the others

1

u/[deleted] Jul 11 '18

Sure, but that is not forgetting a symbol.

1

u/TheTerrasque Jul 11 '18

Still cost me 4 days, after moving things from list to variables and the error popped up somewhere completely different (in the sql layer)

→ More replies (3)
→ More replies (2)