Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Top stupidest programming polemics

Name: Anonymous 2013-05-22 21:46

1. Gotos considered evil
For too long, schools have been successfully spreading the fallacy that gotos should never be used. Whenever I write code for someone and I use a goto, someone always complain:
"Man, you used gotos to [Handle errors/Break out of multiple loops/we]"
So knowing usually the kind of people I'm dealing with I respond:
"Why?"
But people always fail to know the real reason gotos used to be bashed on:
"They're just evil..."

2. Tabs vs. Spaces for indentation
Everyone using a real text editor knows that tabs are by far superior to spaces. There are easily at least five times more reasons to use tabs than to use spaces. Even worse than that, the reason I hear the most often to use spaces is that "tabs don't have the same number of spaces in text editors" while IT IS THE WHOLE FUCKING IDEA OF USING TABS, ANYONE CAN SEE AS MANY SPACES AS THEY WANT.


3. Global variables are bad

No. Just like gotos, they are when idiots don't know when to use them.

Name: Anonymous 2013-05-23 8:12

>>16
That's a misuse of global variables...

It is the fault of the author of unexpert_programmer() that it does what it does, just as it is the fault of the authors of A and B that they attempt to set up a global state in a situation that should not use a global state*.
I absolutely agree.

*No, not all code is library code, or should be written as if it is.
Quite right.

The issue is that most situations that use global variables can be rewritten to not use global variables...
That's not the issue. You never have to use global variables, but there are things you can't do without goto.

The same meaning can be accomplished with or without global variables, and the difference is often superficial. It's partly a question of how explicit you want the plumbing to be.

It's true that global state can make some things simpler to start with (I use it often in small programs), but the complexity is growing rapidly the more widely it is used and the larger the program gets. For small simple cases that you have total control and understanding of, yes, global variables is no big deal. At the end of the day we have to ship.

The point is that “global variables are bad” is true in the sense that “GOTO is bad”. It's meant to deter inexperienced programmers from misusing them by having them avoid it all together. But as the aspiring programmer grows in experience she'll understand the reason behind those statements and start to use them wisely. An unfortunate side effect is that programmers that have already passed that point get odd looks from ones that hasn't, and sometimes inexperienced programmers think they know they've understood it and makes us look bad.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List