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 6:58

3. Global variables are bad
Of course not by definition, but their use introduces a lot of dependencies that especially inexperienced programmers are unaware of. It's basically the same argument as to why GOTOs are bad. But more so than GOTOs, global variables seem to make things simpler to beginners because there are less parameters to pass around, but the fact is that complexity skyrockets when access to a variable comes from unexpected places at unexpected times. This is shared state where there's no control over extent or visibility.

But sometimes that's no problem. If the program is small enough the global state can be allowed to be accessed from anywhere (maybe through an interface of procedures, same thing) and everything is still comprehendible. Then the only problem is code sharing. Libraries with global state can be problematic. What if library A has a procedure initialize_A() that sets up global state, and library B

Name: Anonymous 2013-05-23 7:01

has a procedure initialize_B() that sets up global state, as well as calling initialize_B(), and the program C which depends on both A and B is calling initialize_A() and initialize_B()? There can be flags to make sure it's only initialized once, but what if C initialized A with different parameters than B does? It gets very messy.

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