2022 Developer Survey is open! Take survey.
98 votes
Accepted

How to explain the concept of a variable to a 9-year old?

Buffy's lovely answer shows well how two variables can refer to the same thing, but since we are in early cognitive development and working with Scratch, in which you can't pass parameters, and can't ...
user avatar
  • 31.2k
41 votes

How to explain the concept of a variable to a 9-year old?

My usual explanation is related to names; specifically names of people. People have names. The names are not the people, but can be used to refer to the people. Some people don't have any names at ...
user avatar
  • 34.7k
27 votes

How to explain the concept of a variable to a 9-year old?

What about You have alot of values that you need to remember, so you put a label on each one (a little piece of paper to remind you what this value means) so you can find the value easily when you ...
user avatar
  • 379
21 votes
Accepted

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

I actually cover this idea in my very first lesson in AP Computer Science, because I have found that students find the different uses of = to be confusing, indeed. ...
user avatar
  • 31.2k
16 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

When I have taught this, I have said that = in programming is just a different thing to = in maths. It's unfortunate that ...
user avatar
14 votes

How to explain the concept of a variable to a 9-year old?

The variable that children are most familiar with is score: whether in computer games, sports or board games, a child will almost certainly understand that a score is a value that is clearly not ...
user avatar
  • 241
12 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

If your students are coming from a math background, teach them that in most programming languages, all variables have a hidden subscript on them corresponding to a time/step-number (i.e. they're ...
user avatar
11 votes
Accepted

Order to Teach Topics in an Intro Programming Class

I think this depends entirely on the programming language you use. Or maybe more accurately, you should choose a language that allows you to introduce the concepts in the order you want. I would use ...
user avatar
11 votes

How to explain the concept of a variable to a 9-year old?

Memory is a linear sequence of storage locations. Like a lined sheet of paper. Take a lined sheet of paper and choose a line. In the left margin, write a label. The variable is that label - it ...
user avatar
10 votes

Order to Teach Topics in an Intro Programming Class

I'm self-taught, but here are my thoughts. 0. Language I learned using a combination of Python (once I started to get more serious about programming, I actually don't remember how I stumbled across ...
user avatar
  • 4,684
8 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

I'm going to explore an orthogonal concept that sheds light on the question at hand: What is a variable? In mathematics a variable is a representative for some value, a name. It may be a name for ...
user avatar
  • 34.7k
7 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

When and how should the differences be pointed out to students? When: As soon as you introduce one of those operators... On the "how" - I'd try to not beat around the bush, so to speak, but to point ...
user avatar
  • 1,379
7 votes

How to explain the concept of a variable to a 9-year old?

I just saw Buffy's answer so all credits to @Buffy and though I could simplify it with one word in a way that 9 year old me would have understood. (Although bear in mind I was also mucking around ...
user avatar
  • 171
6 votes

Why would mutation be considered by some as a difficult concept to grasp?

I personally teach mutation almost immediately. However, I agree with Buffy that more difficult is not really the metric people are using to decide to teach mutation later. It is about giving ...
user avatar
  • 31.2k
6 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

All of the below is meant to be thoughts/analogies/illustrations to help explain the difference (meant to be said to students) but in reality, this is all dependent on the level of your students. The ...
user avatar
  • 4,684
6 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

I don't teach CS in any official capacity but I have tutored a number of friends and colleagues on the basics. I find that differentiating the language I use when describing the different concepts ...
user avatar
  • 171
6 votes

Order to Teach Topics in an Intro Programming Class

In Structure and Interpretation of Computer Programs (SICP) (a book, video series, and university course), they do not cover variable mutation until around half way. They covered what seemed like ...
user avatar
6 votes

How to explain the concept of a variable to a 9-year old?

It might be a bit indirect but around that age I bootstrapped myself from fill in the blank math problems through basic algebra to more generalized variable use. eg I started with having been given ...
user avatar
6 votes

How to explain the concept of a variable to a 9-year old?

If I remember correctly, Scratch has two kinds of variables - object-bound and global. When teaching my son about Scratch, at the time of introducing variables I told him he had been working with ...
user avatar
  • 61
6 votes

Concept of variable

Why complicate matters with contrived analogies like hotel rooms and guests? It is much more straightforward to take the analogy of a simple paper "form" (which absolutely everyone in ...
user avatar
  • 219
5 votes

Do Python and Java lead students to construct different mental models of memory?

I think that this is an interesting question, and one the textbooks often ignore or treat as unimportant. I've noticed it because I end up teaching Python, Java and C++ and have seen how my student's ...
user avatar
5 votes

Do Python and Java lead students to construct different mental models of memory?

I am not aware that cognitive modeling of memory structures in early programming education has been directly studied, so anything that I say here is entirely speculative. However, I suspect that the ...
user avatar
  • 31.2k
5 votes
Accepted

Concept of variable

The use of an analogy is to provide a familiar jumping-off point to introduce something new. Since variables are unique features of computing systems, different from how anything else in the universe ...
user avatar
4 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

I would generalise this, because other symbols and terminology are also affected (">" or textual statements such as commands). Start by explaining that symbols and terms in each language have ...
user avatar
  • 211
4 votes

How do I teach "math equality" vs. "CS assignment" vs. "CS equality logic operator"?

I've not tried the following, so I'm unable to vouch for their effectiveness, but if you're looking for suggestions: Avoid assigning variables directly (i.e. x = y) Hide the implementation in ...
user avatar
4 votes

Why would mutation be considered by some as a difficult concept to grasp?

The concept of a variable is not hard in and of itself, but it is the first conceptual hurdle for students. The problem is that in common usage we use the same symbol for comparison and immutable ...
user avatar
  • 968
4 votes

Order to Teach Topics in an Intro Programming Class

I am of the school of thinking that starting at an abstract level causes too many students to consider computation as inscrutable magic. And that can lead to broken mental models and buggy ideas ...
user avatar
  • 1,897
4 votes

Why would mutation be considered by some as a difficult concept to grasp?

I'll give a general answer that you need to think about before it really registers. It applies to both the OOP case and the more C-like case. A program with a high percentage of immutable values is ...
user avatar
  • 34.7k
4 votes

Why would mutation be considered by some as a difficult concept to grasp?

The fundamental element of a computer is a memory cell, which we often refer to as a variable. But what is most important about it is that it can instantly take a new value by being given an ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible