Quote:
I can not believe you are actually entertaining this troll... Look at his answers for crying out loud, he is just messing around with you guys, this post was created as flamebait in the first place. Either ban him, ignore him, sue him for spamming, lock his posts, or whatever, but answering his questions does not serve ANY purpose. The way you're behaving now makes everyone here look childish.
Moderators, please do something about it.
**sigh*
I agree, and I am sorry. I should have followed Prelude from the start and closed the thread right after moving the off-topic posts from the other thread., instead of being curious of what "mathematical proof" esbo was talking about.
Quote:
You dont have to worry about the scope of the variable so you can use it anywhere in the
program. With local cariables you have the extra concern of the scope thus global variables
are easier to use.
Sorry, that is not a mathematical proof.
I note that esbo is wrong: with local variables there is no extra concern of scope, since the scope is entirely local.
Quote:
Which is more than I can say for, Windows XP, Internet explorer, Outloook express, Firefox.......etc.........etc...etc.......all extensible no doubt.
I note that these programs are several magnitudes larger than what esbo has ever written, or will ever write.
Quote:
It is not a mistake the function does not return anything, where it that int it returned?
I can't seem to find it.
I note that esbo missed the point that without explicitly specifying a return value, the return value of a function is either int by default, or possibly undefined. To achieve what esbo wanted to achieve, use a void return type in your programs.
Quote:
It is perfectly easy to see where the variable is used in the program, you just do a search on it. The beauty of global variables is that they can be modified anywhere, it is not a failing it is a strength. Only takes a few clicks of the mouse to see where the variable is used.
esbo clearly has never tried reasoning about the correctness of his programs (and yet dares to demand "mathematical proofs"). Searching for a mess of global variables makes reasoning about correctness difficult since you need to keep track of all the global variables of the program. With local variables, you only need to keep track of those variables in the current scope.
Quote:
Futhermore to say that local variables are easier to understand is wrong, local variables
can change other variables in the program via return values. Not only that it could change
any variable of the same type throughout the program.
esbo does not understand the concept of flow of control: in fact, this is reason to believe that his "larger" programs are full of spaghetti code.
Quote:
Now if you want to find out how that local variable affects the rest of the program you have to look at all the calls to that function and various different variables affected by that call,
esbo does not understand that one would not want to find out how a local variable affects the rest of the program. There is no need to, unlike for global variables. This is the very idea of locality of reference.
Quote:
I have seen stuff being passed down through 4 or 5 levels of functions, the name changing each time. In making their program 'less complex' and easy to follow they create the biggest labyrinth of complexity ever seen.
Due to this global variable mindset, esbo misses the point that we do not need to care about the other functions, since we are only concerned with local scope. Within local scope, we choose the most descriptive names for our variables, thus documenting the program as it is written.
Quote:
If you want to make you program imcomprehensible avoid using global variables.
Mind you when you come back to it in a few months you won't be able to undestand it either
Computer science and engineering literature says otherwise, as does my own personal experience.
Quote:
What happens is a novice programmer discovers how to use local variables and then
use then excessively because he now an 'experienced programmer'.
Chance are you will never use the function again so you are just creating work for yourself
and making your program unnecessarilly complicated. Every variable you pass is an oppertunity to make an error. get the types wrong and you will have some nice exotic bugs
which could lay dormant for some time.
esbo does not see another reason to use functions aside from extracting commonality in code: to help separate logical portions of the program.
Quote:
I have a 1000+ line program it has 17 local variables, about 80 global variables, and 6
functions, one of which requires 2 arguements. None of the functions return any values.
It works fine and is easy to follow.
I don't find any problem whatsoever with the global variables. Infact it is the function which
is passed values which is hardest to follow
"Easy to follow" can only be the valid opinion of a code reviewer. The opinion of the code author means nothing, no more than that of a child proclaiming his first poem to be the greatest that was ever written.
Now that I have addressed esbo's points (again going against Prelude's wisdom :( )...
*thread closed*