# Variables and Constants

One of the challenges of teaching a weekly class has been ensuring that enduring understandings remain between lessons. The middle school computing offerings at ISA are aimed at providing students a supportive computational bridge between elementary and high school years. This has meant that we are constantly looking for ways to integrate computing in other subject areas so that students not only see purpose but also build more robust solutions using a computational setup. One critical piece of this evolving curriculum has been the introduction and management of variables and constants in programming to allow a wide range of processing to happen. Unlike the IGCSE and IB programs where students work mainly with text based languages (JavaScript / Python / Java in the past), the middle years offering is aimed to be an incremental blend between block and text based coding to help them transition.

This post, hence, is about documenting a couple of projects we have built / are building for students to master this ability in their solutions.

### The focus on user choice

One of the first terms we establish in the course is user. This is defined as someone who may find your program useful / entertaining / informative / purposeful. Every new concept then covered is keeping this user in mind. Allowing this user choice in how they wish to interact with the program has helped students build in different interactive elements which then has lead to learning about variables and constants.

Example 1

Grade 8 students recently completed a project aimed at children learning basic math. Their solution was built on CoSpaces and used basic variables to hold answers to randomly generated mathematical tasks. Each student interpreted the task in their own way and here are some examples of their design approaches.

Here, the student used a maze like approach where the an animal or bird is guarding the access. You need to answer the question they pose by clicking on the controls (+ and – buttons on the side). The correct answer makes the animal/bird make way thus allowing you to move forward or to the next question.

Variables were used to hold the randomly generated numbers and the value the user is choosing using the + and – controls.

They usage of ” ” quotes was then established as an indicator of a constant since anything placed with them does not change when the program runs.

You may try out this program here.

Example 2

Grade 7 computing designed story prompt generators to better understand variables and constants. This project required them to think of the solution as a face – the front end with choices for the user and the brain – the code logic that would read/store user choices to allow for a wide range of outputs to be processed. Given below are a couple of good student examples.

In these projects the focus remained on the program’s ability to create as many variations of the story prompts as possible. They read the user choice into appropriately named variables and then created various selection statements to produce a range of possible prompts. Given below is one such example. Students were required to design the story prompts before coding them so that the flow of the code was more manageable. You may try these samples here and here.

### Building in purpose

Students have engaged well with work which had interdisciplinary links. We have recently completed various other design and computational projects with subjects like Media Studies and Visual Arts that have allowed students to tap into knowledge from other subjects to build computing models. As we go forward next term, the aim is to continue this overlap so that fundamental concepts such as variables in programming can find a stronger and deeper understanding with student work. I hope to revisit this again in a few months to document their creations!