rtcvb32: You have to break instinctive habits to be a programmer. For you and me, we've probably made this transition long ago. For someone new? I'm not so sure. I once helped as a teaching assistant (
since i was the top of my class) and no matter how i tried to explain or drill very simple concepts involving programming and Java, it wouldn't sink in for some people, it just can't (
probably because it becomes too stressful and they quit long before they break past that threshold).
So much this. I remember it took me quite some time to understand what variables are for. (To be fair, it was a year after I first saw a computer, and I didn't have one at home, so i had only a faint idea of what
computers are for.) The instructor said, "Let's write a simple progam that adds two numbers together, like, 3 and 5". The numbers were put in as variables, so I wrote something like
input X, input Y, print "3 + 5 = "X+Y, compiled (compiling was sorcery, literally) and ran it, submitted random numbers for input and couldn't understand why the program wasn't printing 8. After experimenting more, I figured out it was printing the sum of whatever I typed in rather than 8 and
thought it was a bug. Like, "Uh, I'm trying to add 3 and 5, but I only get 8 when I type in 3 and 5". I don't know how the instructor managed to keep a straight face, but he did and said, "You'd better rewrite this line as print X "+" Y " = " X+Y, this way, a user can add any two numbers. This is why we're using variables, not constants. There's not much use for a program that just adds 3 and 5".
And SUDDENLY EVERYTHING MADE SENSE.
(Except object-oriented programming. It wasn't taught in school and had to wait until several years after graduation, when I got my hands on source code for commercial Java software.)