Answers.Body: <p>I love Buffy's answer!</p>
  <p>On a very practical level, though, I suspect that they won't convert over to using formulas until it makes their lives significantly easier.  Using lots of rows of data along with drag-downs is an easy way to accomplish this.</p>
  <p>You can use fake data as long as you make it plausible, and then it can be fun.</p>
  <blockquote>
  <p>Here are some statistics for 350 heavy players of &quot;Call of Duty: Warzone&quot;, &quot;Animal Crossings: New Horizons&quot;, and &quot;Among Us&quot;.  We need to figure out who the top 5 overall players are.  First, we have to figure out an <em>adjusted score</em> for each game, since the scores don't compare in any obvious way across games.  Then, we'll need to create rankings.  Then we'll have to average performance across the three games to figure out who is best.</p>
  </blockquote>
  <p>... it's not a perfect example, but it is something that would be basically impossible to do without using cell references.</p>
  <p>Anything with several columns and many rows of data will do, and the more fun the data itself is, the more fun the class will have if they're not naturally motivated by the topic itself.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T22:48:23.147Z
Answers.LastActivityDate: 2022-11-16T13:25:47.957Z
Answers.LastEditDate: 2022-11-16T13:25:47.957Z
Answers.UserDisplayName: Ben I.
Answers.Body: <p>This isn't going to be limited to spreadsheet programming, but, more generally, to any sort of programming with mutable data. This excludes pure functional programming, but includes things like procedural programming and object-oriented programming, at least.</p>
  <p>The main issue, I think, is that the word &quot;variable&quot; is used in different senses when we program and in different senses in mathematics from which the programming terminology was evolved. I think the problem is most acute with younger students who are learning programming along with algebra rather than, say, calculus.</p>
  <p>Distinguish two cases: First is 0 = 2x * 8. Second is y = 2x * 8.</p>
  <p>In both of these the word &quot;variable&quot; is often used, though &quot;unknown&quot; might be used in either case, though more likely the first.</p>
  <p>But in the first case, x doesn't vary if the equation is to be true. There is only one value that makes it work. In quadratic equations there might be two values, but, still, fixed, though possibly unknown values.</p>
  <p>In the second case we are describing the functional relationship between two (or more, in more complicated examples) variables. So, we also write the second case as f(x) = 2x * 8, naming the relationship as &quot;f&quot;. But if you set a value for either x or y, the value(s) of the other is determined. It becomes fixed, not variable.</p>
  <p>I think you need to get over this hurdle with students before you are likely to resolve your difficulty. With many, a logical explanation might work, but I'm not sure all are yet sufficiently sophisticated to grok it. After all, their forebrains are still developing and with it their ability to think abstractly, though it develops rather quickly starting at that age.</p>
  <p>The other difficulty is that the notion of a &quot;variable&quot; is not consistent in programming. For some, it is a &quot;box&quot; into which you can put a &quot;value&quot;. And the value in the box is mutable. For others, a variable assignment is a &quot;name&quot; that you associate with a value. The latter is the case with functional programming, of course, but the former is often used in languages that have something like C or FORTRAN as an ancestor.</p>
  <p>I'm not certain how I can guide your students learning spreadsheets, since I don't know their backgrounds, but if they have some prior experience with C-like programming, they might have this confusion about the nature of a variable. I think, however, that you want them to think of a &quot;variable&quot; in the functional sense, not the &quot;unknown&quot; sense.</p>
  <p>And, with unsophisticated thinkers, a set of simple examples might work, at least initially, using the &quot;box&quot; with a value concept (though I don't like that idea generally). But, suppose you put a 5 in &quot;this&quot; box? What will show up in &quot;that&quot; box? Suppose it is a 9 instead? Thus, starting with a simple two cell &quot;spreadsheet&quot; might get them thinking as you'd like. Then, develop a more sophisticated model with one or more intermediate &quot;boxes&quot; related to other &quot;boxes&quot;.</p>
  <p>The development of abstraction capabilities in the young mind can't be overlooked, however. Psychologists tell us that it won't likely be fully developed until around 25 years old. There are some (well known) exceptions, of course, but the young mind needs a more sophisticated brain, which is developing in those years.</p>
  <hr />
  <p>Let me add some additional advice since you say the students aren't particularly enthusiastic about the topic, but are required to take it. Perhaps you should evaluate your overall goals for student education and ask whether spreadsheets is the best vehicle for achieving them. Perhaps some other area of CS (or even math) would better meet their needs. It might even be that the very &quot;concrete&quot; visual representation in a spreadsheet is actually contributing to the issue. If the goal is to increase their abstraction capabilities then there might be a better vehicle.</p>
  <p>While recent spreadsheet programs are technically Turing Complete, I find them about as easy to program for complex tasks as I would a Turing Machine itself. I've known some who can do that, but I don't find it easy to conceptualize in that way.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T15:00:09.593Z
Answers.LastActivityDate: 2022-11-16T11:50:19.017Z
Answers.LastEditDate: 2022-11-16T11:50:19.017Z
Answers.UserDisplayName: Buffy
Body: <p>The more experience I have in teaching CS the more I become convinced that one of the most difficult ideas to grasp for (beginner) students is that of <em>changing the inputs</em> (if not the most difficult of all).
  This is so trivial and basic for us that I think we struggle to understand what's so difficult in it, at least I do.
  This point is what I call the algebraic aspect of computation, because, at a beginner level, it has something to do with the meaning of the dreaded <code>x</code> in mathematics that so many students seem to fail to understand, which is to say, the idea of <em>variables</em>.</p>
  <p>In today's frustration I bring you the case of my students who, having nonetheless spent weeks copying and writing formulas in a spreadsheet, still persist in writing formulas without variables, even in cases where it's &quot;just so obvious&quot; that we want a result of a computation <em>with some data</em>: they just read the data and write a constant in the formula. <strong>I can't understand the reasoning behind this: what, in their opinion, is the usefulness of writing such a formula?</strong></p>
  <p>It became quite apparent observing them when doing it correctly that their only drive to use variables (cell references) is <em>&quot;the teacher wants it so&quot;</em>: of course this means that they have no will whatsoever of doing it when I'm not watching.</p>
  <p>There's even another, so to say interesting, fact: when they need a small computation for themselves, they prefer going to their backpack, take out a calculator and doing it with maybe many calculation steps and often incur some errors and <em>doing it again maybe from the beginning because they lost the intermediate results</em> instead of using 2 or 3 cells of the spreadsheet that they have ready in front of them.
  Fully oblivious of the usefulness of the tool that we have studied for months.</p>
  <p>I know that this student behaviour is not new and I'm sure a lot of teachers have dealt with it.</p>
  <p>The main way I (desperately) try to make them aware of all this is by saying <em>and demonstrating with lots of examples</em> that:</p>
  <ul>
  <li>We want it to work when we change data.</li>
  <li>We want to be able to use the same formula for many other cases (copy and make a long table).</li>
  </ul>
  <p><em>But this seems highly ineffective</em>: no connection with their inner drive, even when we beforehand state the computation that we're going to realize and see that it <em>naturally wants to be repeated in different cases</em>.</p>
  <p>It struck me recently that, in asking them a question of the kind &quot;what's the result of such and such step of our computation&quot; (we did a thing made of 3 steps: <span class="math-container">$f(g(h(x)))$</span>) they wrote &quot;7&quot;.</p>
  <p>Again, fully oblivious of the fact that &quot;the step&quot; can and will be done with differing inputs (of course we had done it and saw it on the screen and remarked it many times).</p>
  <p>I'd like to ask if you can share your experience or intuitions about this issue, and if you have any suggestions.
  Especially since it's so foundational that nothing can be done in computing without this awareness, besides of course they merely copying what I do or guessing what I want from them without having any clue about the meaning.</p>
  <p>Keep in mind that the goal for the students in these classes is to learn to use a spreadsheet and, in the minds of those who have no idea who the students are, make some data analysis.
  Keep in mind, moreover, that these students are not going to be scientists of any kind, the opposite: they are those that struggle a lot in understanding sentences in our own native language and make plenty of grammatical errors.
  We talk about 14-15 years old who have no passion for studying and are there only because school is mandatory, struggling with mathematics and logic.</p>
  
Tags: <variables>
Title: The algebraic aspect of computation, or how to make them understand the usefulness and the meaning of variables
ThreadText: # The algebraic aspect of computation, or how to make them understand the usefulness and the meaning of variables
  
  (Asked by: username_0 on 2022-11-12)
  
  The more experience I have in teaching CS the more I become convinced that one of the most difficult ideas to grasp for (beginner) students is that of *changing the inputs* (if not the most difficult of all).
  This is so trivial and basic for us that I think we struggle to understand what's so difficult in it, at least I do.
  This point is what I call the algebraic aspect of computation, because, at a beginner level, it has something to do with the meaning of the dreaded `x` in mathematics that so many students seem to fail to understand, which is to say, the idea of *variables*.
  
  In today's frustration I bring you the case of my students who, having nonetheless spent weeks copying and writing formulas in a spreadsheet, still persist in writing formulas without variables, even in cases where it's "just so obvious" that we want a result of a computation *with some data*: they just read the data and write a constant in the formula. **I can't understand the reasoning behind this: what, in their opinion, is the usefulness of writing such a formula?**
  
  It became quite apparent observing them when doing it correctly that their only drive to use variables (cell references) is *"the teacher wants it so"*: of course this means that they have no will whatsoever of doing it when I'm not watching.
  
  There's even another, so to say interesting, fact: when they need a small computation for themselves, they prefer going to their backpack, take out a calculator and doing it with maybe many calculation steps and often incur some errors and *doing it again maybe from the beginning because they lost the intermediate results* instead of using 2 or 3 cells of the spreadsheet that they have ready in front of them.
  Fully oblivious of the usefulness of the tool that we have studied for months.
  
  I know that this student behaviour is not new and I'm sure a lot of teachers have dealt with it.
  
  The main way I (desperately) try to make them aware of all this is by saying *and demonstrating with lots of examples* that:
  
  * We want it to work when we change data.
  * We want to be able to use the same formula for many other cases (copy and make a long table).
  
  *But this seems highly ineffective*: no connection with their inner drive, even when we beforehand state the computation that we're going to realize and see that it *naturally wants to be repeated in different cases*.
  
  It struck me recently that, in asking them a question of the kind "what's the result of such and such step of our computation" (we did a thing made of 3 steps: $f(g(h(x)))$) they wrote "7".
  
  Again, fully oblivious of the fact that "the step" can and will be done with differing inputs (of course we had done it and saw it on the screen and remarked it many times).
  
  I'd like to ask if you can share your experience or intuitions about this issue, and if you have any suggestions.
  Especially since it's so foundational that nothing can be done in computing without this awareness, besides of course they merely copying what I do or guessing what I want from them without having any clue about the meaning.
  
  Keep in mind that the goal for the students in these classes is to learn to use a spreadsheet and, in the minds of those who have no idea who the students are, make some data analysis.
  Keep in mind, moreover, that these students are not going to be scientists of any kind, the opposite: they are those that struggle a lot in understanding sentences in our own native language and make plenty of grammatical errors.
  We talk about 14-15 years old who have no passion for studying and are there only because school is mandatory, struggling with mathematics and logic.
  
  **Tags:** variables
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-11-14. Score: 4 | Accepted answer
  
  I love username_2's answer!
  
  On a very practical level, though, I suspect that they won't convert over to using formulas until it makes their lives significantly easier. Using lots of rows of data along with drag-downs is an easy way to accomplish this.
  
  You can use fake data as long as you make it plausible, and then it can be fun.
  
  > Here are some statistics for 350 heavy players of "Call of Duty: Warzone", "Animal Crossings: New Horizons", and "Among Us". We need to figure out who the top 5 overall players are. First, we have to figure out an *adjusted score* for each game, since the scores don't compare in any obvious way across games. Then, we'll need to create rankings. Then we'll have to average performance across the three games to figure out who is best.
  
  ... it's not a perfect example, but it is something that would be basically impossible to do without using cell references.
  
  Anything with several columns and many rows of data will do, and the more fun the data itself is, the more fun the class will have if they're not naturally motivated by the topic itself.
  
  
  ---
  
  ### Answer by username_2 on 2022-11-14. Score: 4
  
  This isn't going to be limited to spreadsheet programming, but, more generally, to any sort of programming with mutable data. This excludes pure functional programming, but includes things like procedural programming and object-oriented programming, at least.
  
  The main issue, I think, is that the word "variable" is used in different senses when we program and in different senses in mathematics from which the programming terminology was evolved. I think the problem is most acute with younger students who are learning programming along with algebra rather than, say, calculus.
  
  Distinguish two cases: First is 0 = 2x \* 8. Second is y = 2x \* 8.
  
  In both of these the word "variable" is often used, though "unknown" might be used in either case, though more likely the first.
  
  But in the first case, x doesn't vary if the equation is to be true. There is only one value that makes it work. In quadratic equations there might be two values, but, still, fixed, though possibly unknown values.
  
  In the second case we are describing the functional relationship between two (or more, in more complicated examples) variables. So, we also write the second case as f(x) = 2x \* 8, naming the relationship as "f". But if you set a value for either x or y, the value(s) of the other is determined. It becomes fixed, not variable.
  
  I think you need to get over this hurdle with students before you are likely to resolve your difficulty. With many, a logical explanation might work, but I'm not sure all are yet sufficiently sophisticated to grok it. After all, their forebrains are still developing and with it their ability to think abstractly, though it develops rather quickly starting at that age.
  
  The other difficulty is that the notion of a "variable" is not consistent in programming. For some, it is a "box" into which you can put a "value". And the value in the box is mutable. For others, a variable assignment is a "name" that you associate with a value. The latter is the case with functional programming, of course, but the former is often used in languages that have something like C or FORTRAN as an ancestor.
  
  I'm not certain how I can guide your students learning spreadsheets, since I don't know their backgrounds, but if they have some prior experience with C-like programming, they might have this confusion about the nature of a variable. I think, however, that you want them to think of a "variable" in the functional sense, not the "unknown" sense.
  
  And, with unsophisticated thinkers, a set of simple examples might work, at least initially, using the "box" with a value concept (though I don't like that idea generally). But, suppose you put a 5 in "this" box? What will show up in "that" box? Suppose it is a 9 instead? Thus, starting with a simple two cell "spreadsheet" might get them thinking as you'd like. Then, develop a more sophisticated model with one or more intermediate "boxes" related to other "boxes".
  
  The development of abstraction capabilities in the young mind can't be overlooked, however. Psychologists tell us that it won't likely be fully developed until around 25 years old. There are some (well known) exceptions, of course, but the young mind needs a more sophisticated brain, which is developing in those years.
  
  ---
  
  Let me add some additional advice since you say the students aren't particularly enthusiastic about the topic, but are required to take it. Perhaps you should evaluate your overall goals for student education and ask whether spreadsheets is the best vehicle for achieving them. Perhaps some other area of CS (or even math) would better meet their needs. It might even be that the very "concrete" visual representation in a spreadsheet is actually contributing to the issue. If the goal is to increase their abstraction capabilities then there might be a better vehicle.
  
  While recent spreadsheet programs are technically Turing Complete, I find them about as easy to program for complex tasks as I would a Turing Machine itself. I've known some who can do that, but I don't find it easy to conceptualize in that way.
  
  
  ---
  
  