The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

95

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 arrange for two different names to refer to the same instance/spawn, I wouldn't focus my efforts on that point yet. What matters is the idea of a holding place ...


37

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 all. This is common just after birth at least, before the parents decide on a name. Names can be changed. A person can have a name for a while and then later ...


27

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 need it.


14

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 constant. Variables are abstract, but using familiar examples turns this into something easy to grasp. Once numeric variables are understood, you can extend the ...


12

I highly recommend checking out a language called Processing. Processing is designed for novices, and makes it easy to create visual and interactive programs without a ton of boilerplate. Here's an example Processing sketch: void draw() { ellipse(mouseX, mouseY, 25, 25); } This is a full program that draws a circle wherever the mouse is, 60 times per ...


11

The analogy is far from perfect, but Snap! is to Scratch as Mycroft is to Sherlock. For me, the big advantage for Snap! is its provision of custom functions rather than just the custom blocks that Scratch 2 offers - Snap! functions return values that can be passed to other functions and so on, making it much easier to implement mathematical ideas and to ...


11

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 gives a name to a spot. Now look for the label and write something to the right of the margin. That is assignment.


9

Tl;dr: use python. (Preferably python 3.) Well, I’m a teenager in your age group, so hopefully I’m some level of qualified to respond. I have to say as a bit of a disclaimer that python is my favorite language but it is in that position for a reason. Scratch is, for me, annoying to write because I can touch type so python is just faster. Further, I ...


7

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 with Visual Basic 6 at 9 years old so this could also be very inaccurate & harder to grasp) A nickname. x = "the name of the program in scratch"; x is the ...


6

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 problems like: 5 + __ = 9, what number goes in the blank? From there naming the blank to get to basic algebra problem: 5 + X = 9, solve for X. From ...


6

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 object variables/properties the whole time: the position x and y (and to a lesser extent the object sprite/appearance (not sure what it is called in the English ...


6

The middle column is Snap!. In Snap! you can create your own C-shaped blocks, as well as functions (see range block), this is in addition to the procedures that can be done in scratch. Note: I could not get the last one to work, but some times you only need to get the image. However the others do work (fully functional).


5

The biggest features Snap! has that Scratch doesn't are first-class EVERYTHING and functions. Scratch only lets you create custom command blocks, not reporter or Boolean blocks. This makes Snap! much more suitable for writing algorithms that rely on return values. In Snap!, everything is first class. You can pass around scalar values, lists, blocks (and ...


5

Words matter. The problem is that the kids need to communicate the ideas to one another and to teachers, etc. They also need a way to integrate their Scratch experience into a larger programming set of ideas that they can carry with them. It is good that you are trying to help, but you need to prepare yourself better first. Build a quick-look glossary for ...


4

Here's an unlikely answer: Teach them C. You're correct, Scratch will be a turn-off to an average 14 year old. Mid-teens dislike things that seem fake and/or useless, and have a strong aversions to things seemingly geared toward younger children. Python is probably an OK option... but I believe Python is a little too high level, using concepts that may ...


4

A variant on the usual random drill and practice test would be to pre-populate with the questions and answers, then remove question and answer from each as they get answered correctly, allowing players to get more practice on the questions they get wrong. Here's an example for times tables. You could try something for an adventure game, building up an ...


4

If this child plays Minecraft, you can try the following analogies: A variable is like a chest with a sign next to it. You can put stuff into a chest (assignment). This "stuff" in the chest is the value of the variable. A function is like a workbench, which transforms inputs (like wood) into the result (like wood planks in Minecraft). It is also helpful to ...


4

First of all, kudos to you for teaching Scratch to kids! Vocabulary forms tokens of ideas that we can pass on to one another, and it is no coincidence that much of early childhood is spent with a parent telling a child, "this is a doorknob", and "this is a can opener". These identifiers allow us to summon, link, and morph ideas. We organize our thinking ...


3

Honestly all these analogies are extremely confusing. The box analogy was the best. I would just add to it. You have a box that has its entrance restricted like those block match toys for babies (to match shapes - for example they only take circles, or stars, etc). Some boxes only take stars (int), squares (string) etc. The box is small and only has enough ...


3

On Steam is the game Human Resource Machine. While it is a game it is played using simple programming commands as blocks like Scratch, has an input and output conveyor and several places to hold intermediate calculations or values, think variables. Latter in the game you can even name the locations. While some of the problems are too hard for someone 9 ...


3

Show them the cool stuff they can do with Scratch. Don't focus on explaining that they can't make a AAA game. Focus on showing them examples of stuff that is engaging and interesting, that they can do with Scratch. Come up with a showcase of interesting programs. Make sure your assignments are engaging and interesting. Taking a step back, I'd also ...


3

I think it largely depends on the kids. If you are proficient in both you might even want to give them a choice (as a class, not individually). Show them a bit of each in the first session and let them discuss the options. It might make them more connected to the course, in fact. Either is appropriate in general, but the background of the students might ...


3

There are a number of fine answers already here. This is how I thought of doing it, and it might provide another alternative that should be suitable for a 9 year old, and possibly younger. It should be something that gives a good visual image for the child to picture mentally. If I were speaking to the 9 year old: Say one day you decide you're really ...


2

The box analogy seems good to me. If you want to continue the programming "language" analogy, variables are pronouns. In English, we rely on people using context to figure out what a pronoun refers to, but in programming we explicitly tell the computer what the pronoun refers to. You could have variable names like "it", "that", "the_thing", "the_other_thing" ...


2

In Python, Java, or JavaScript, I talk about the type system as an ecosystem of different species of smart data. Objects are self-aware chunks of memory to which you can send messages and which can do work for you. I will frame this discussion in JavaScript. Example in Node > console.log("foo".length); 3 As you know, it rapidly becomes tedious to do ...


2

I like to explain it as a placeholder. So that I don't have to read and write so much. I have a friend named John Jacob Jingleheimer Schmidt. His name, John Jacob Jingleheimer Schmidt, is my name too. Whenever I go out with John Jacob Jingleheimer Schmidt, the people always shout. There goes John Jacob Jingleheimer Schmidt. John Jacob Jingleheimer Schmidt ...


2

I find the "box" aspect is far more important than the named aspect. Maybe it's personal bias. However, we can combine the two: it's a named box. So you can say "Go look in the 'object color' box." If you're working with pure data (no objects), it may be effective to set up a white board, and mask off a few "boxes." Each box gets a name like "number of ...


2

Do you use a dry-erase board anywhere to keep track of chores, or a shopping list? An erasable space is a great way to teach the use of a variable. You can even get into data types! Booleans - eg: a tick in a box or the words yes/no against a task trash taken out. I know one mum who had a checklist at the door, so ticking off everything on the list would ...


2

How about flipping it around: People don't learn when you just tell them what to do. So when you are asked a question, answer with a question, for example “What section will you find that in?”, ”show me how you would do that.” (Have them be the cat). As teachers we are told not to be the source of all knowledge, to facilitate. Every time I have a weakness, ...


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