So how the heck do you explain this?
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Wow, having to describe what a name is to a first-grader. Glad I dodged that bullet. I'm going to assume you wanted a straight answer to this question, so ... The Alice-in-Wonderland answer below is an awesome answer, but is probably a bit too hard for a first grader. So you could say, "A name is a short word to describe something. We call you Bob (whatever his name is), or Bobby, or sweetie-pie, because it's faster than calling you 'skinny red-headed kid with the lopsided grin and the goofy sense of humor' all the time. Your name isn't you, it's something we say that picks you out of a crowd. Now 'a' and 'b' are names. They name little boxes in the computer that each can hold a number. There are millions of these little boxes, so we have to give them names to pick them out of the crowd. When we say 'let a = 2' we are saying, put the number '2' into the box whose name is 'a'. When we say 'c = a + b' we are saying, take the number out of the box named 'a', take the number out of the box named 'b', add the numbers together, and put them in the box named 'c'. I actually had the grown-up version of this problem when first learning to program. I didn't understand the difference between symbolic constants, where the name actually meant a number, from variables, where the name meant a storage location into which you could put a number. I didn't get why the assembler (yeah, they taught programming using assemblers, what were they thinking) produced an error when I tried to assign a new value to a symbolic constant.
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
rnbergren wrote:
Ideas? I didn't get anywhere
It sounds like you didn't manage to connect to the concrete knowledge he knows, before you tried to extend his knowledge into something abstract. Perhaps try again, using x & y as variable names. That should make the equation "x + y" look more like something he's familiar with from algebra classes. Explain it as how the computer is computing the result of the algebraic equation. And whatever you do, keep the how-a-computer-does-stuff talk out of any explanation. None of it is relevant to beginning programmers, and just serves to confuse and demoralize them.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
-
If you want to teach variables, don't use terrible variable names. If you example wouldn't pass a code review it isn't a good teaching example. Also with abstract concepts relate them to something concrete. Let PricePerTooth = $0.25 Let NumberOfLostTeeth = 4 HaulFromToothFairy = PricePerTooth * NumberOfLostTeeth
And then... My first programming experience was with BASIC, in those days when it really was BASIC! Numeric variable names were restricted to A to Z and A0 to A9, B0 to B9 etc. up to Z0 to Z9 - 286 numeric variables, if you used them all. String variables were $A to $Z - 26 in all. If your background is like that, statements like "Let NumberOfLostTeeth = 4" makes no sense at all. It provokes a SYNTAX ERROR message, or something of that sort. (Sort of if you - anno 2015 - try to use non-ASCII letters or spaces in a file name on a *nix system... Yes, the underlaying file system can handle it, in principle, but nine out of ten application barf if you simply give them such a filename, plainly, with none of the seven, or is it eight, or nine, different escape/quoting alternatives, only one of which is understood by the application.)
-
I'm at the same stage - I try to explain things in terms of "boxes". Box "a" contains two items, box "b" contains three items, how many items have I got if I add what's in box "a" to what's in box "b"? Pointers and memory addresses are a future topic :laugh:
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Usually when it comes to variables i use this analogy. Let any variable be a room in a file cabinet. We stick on one of them the letter a, that is our variable. We stick on another the letter b, being another variable. In the first, a room, we put the number 2. In the second one, b, we put the number 3. What would result from adding the content of a and the content of b?
-
"Pointers and memory addresses are a future topic Laugh | :laugh:" There are those that never ever get the concept of pointers. These people usually switch majors from programming to marketing. :-O
Fletcher Glenn
I never understood the fuss about pointers, they always seemed pretty straightforward to me. Trying to teach a 6 year old about hex or binary is probably pushing things a bit though :laugh:
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Algebra is a topic that comes later in a child's life because it is a hard concept to grasp. Then you try to tie in the mechanics of a computer that I've seen adults struggle to comprehend. No wonder you are feeling a little under water right now. A computer program ties a process with values that are unknown until supplied. Basically, algebra coded in a computer. This is a tough sale for any newbie. A=2 AB=10 What is B? You have to explain AB is shorthand for A*B, he has to understand multiplication and division, he has to understand substitution, he has to understand the wonder of being able to figure out the value of B without ever being directly told what it is and the processes he followed to find out what B is without ever being directly told what it was. Then, that you could do the same thing with computers. You start too young you may turn him off to math for good.
-
All of your statements are true, and I agree with them as well, for the most part. However, my kid chooses to be what they want, not me. If you need to explain something to someone, and it is turning out to be work, then it may not need to be explained. Frankly, variable assignment discussions with anyone, including engineers, is just boring. :)
Although I agree with what you say, I feel like it is too early to conclude the kid is not into programming yet. In fact, the question it asked is absolutely relevant - why would someone have to know all this stuff for memory addresses and so on, if s/he cannot see for any use of this. I mean, if the kid is given an example - for instance to have some formula, that must be evaluated for a bunch of different values, then it would start making more sense to think of all the same operations that otherwise would be too repetative as a single formula with different digits(values). My point is that the kid just needs a good example, and I am willing to think when he grows older, he will understand this better - not only why and how it works, but when it is used and why.
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Perhaps you are expecting him to run before he can walk? Teach him the basics of algebra and then a + b = 5 should be intuitive. I know we live in an age where logic supposedly triumphs, but teaching things to young people so that they become intuitive makes life a lot easier down the line. When I started writing applications at 13/14 I didn't have any problems at all with such statements because I already had a basic understanding of algebra, hence defining and manipulating variables was already second nature. After all, the use of such variables in computer science was based on mathematics, so why not teach things in the order they happened?
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Try this - write down the math problem in this fashion: 1. 2 + __ = 5 - What is the answer? (3) Then: 2. __ + 3 = 5 - What is the answer? (2) Then: 3. 2 + b = 5 - What is the answer? (b = 3) Then: 4. a + 3 = 5 - What is the answer? (a = 2) Then: 5. if a = 2, then a + 3 = 5, and if b = 3, then 2 + b = 5 Then: 6. if a = 2, and b = 3, and if a + b = c, then c = ? What does "c" equal? If he doesn't get it by this point, then he just isn't ready for simple algebra, and should go back to playing with clay (nothing wrong with this, btw - he just may not be mentally ready). Keep the problem handy, and try it again in a year. Good luck.
-
My son and I often have interesting discussions. Last night was no exception. So I being the geek I am often try to steer the discussion to programming and logic problems. Yesterday we were discussing variable assignments. Something I have notice with other "normal" people. My son is fairly normal even after my influence. (Must be mom). So I as talking about let a=2 and let b=3 So if we add a to b we get what? responses from son ranged from "ab" or "c" I then went into the whole memory address thing where a is just a name for a pointer to a memory address area where the value of "a" is stored. Soon as I asked for the value of "a". His response. "The value of "a" is always "a" right?" *sigh* no "a" is just the name for the pointer to the memory the variable name we use for then storing that value we will use later. "Well why not just type in 2+3 if you are going to add 2 and 3 together?" Ideas? I didn't get anywhere.
To err is human to really mess up you need a computer
Your 'test program' makes the mistake to immediately define all inputs, and your son immediately optimized away the need for variables (good job! ;-) ) By providing the inputs, you immediately nixed the reason for writing the program, and your son understood that (clever guy! ;P ) Maybe you've started it all wrong: you basicaly asked your son to play the role of the computer/debugger. Instead he played the role of an interpreter, that's why he doesn't understand the hassle of 'a' and 'b'. It would be better to first confront him with an actual problem that introduces the idea to use an abstract container (a variable). E. g. evaluate football results from a list of matches. Sometimes you need to do repetitive calculations, and that is where variables come in handy...
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)