Skip to content
Computing · Year 7

Active learning ideas

Variables: Storing Data

Active learning works for variables because students need to experience data changing in real time. When Year 7 students write code that updates a variable continuously during Pairs Coding, they see firsthand how mutability supports interactive programs like games. This hands-on approach builds mental models that abstract explanations alone cannot.

National Curriculum Attainment TargetsKS3: Computing - Programming and Development
20–35 minPairs → Whole Class4 activities

Activity 01

Problem-Based Learning30 min · Pairs

Pairs Coding: Score Tracker

Students pair up in Scratch to create a simple game sprite that awards points on touch. One partner declares a score variable, sets it to zero, and adds change block for increments; the other shows it forever on stage. Pairs test, switch roles, and predict outcomes of doubling points.

Explain how variables can be used to track the state of a game.

Facilitation TipDuring Pairs Coding: Score Tracker, circulate and ask each pair to explain why their score variable updates correctly after each step.

What to look forProvide students with a short Scratch code snippet that uses a variable. Ask them to write down: 1. What is the name of the variable? 2. What is its initial value? 3. What will its value be after the code runs?

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Problem-Based Learning25 min · Small Groups

Small Groups: Variable Naming Relay

Divide class into small groups with code snippets using poor variable names like 'x' for player health. Groups rewrite with descriptive names, then pass to next group to add updates and test in Scratch. Discuss readability improvements as a class.

Design a Scratch program that uses a variable to keep score.

Facilitation TipIn Variable Naming Relay, give each group only three minutes per rename to simulate real-world constraints and spark urgency.

What to look forAsk students to hold up fingers to represent data types: 1 for number, 2 for string. Then, present scenarios like 'player name', 'score', 'dialogue text', and have them indicate the correct type. Follow up by asking them to explain their choice.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Problem-Based Learning20 min · Whole Class

Whole Class: Prediction Demo

Project a Scratch program with a hidden variable for countdown timer. Class predicts display changes as you update it live, then replicate individually. Vote on predictions before reveals to build anticipation and analysis.

Analyze the impact of changing a variable's value on the behaviour of a running program.

Facilitation TipFor the Prediction Demo, pause execution midway and ask students to predict the next value before running the block, reinforcing cause-effect links.

What to look forPose the question: 'Imagine you are making a simple quiz game. What variables would you need to create, and what kind of data would each variable store?' Facilitate a brief class discussion, noting student ideas on the board.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Problem-Based Learning35 min · Individual

Individual: Debug Challenge

Provide Scratch files with variable errors, like uninitialised scores or type mismatches. Students fix alone, run tests, and note fixes in journals. Share one solution per student in plenary.

Explain how variables can be used to track the state of a game.

Facilitation TipDuring Debug Challenge, provide a sample wrong-type error and have students vocalize the mismatch before fixing it.

What to look forProvide students with a short Scratch code snippet that uses a variable. Ask them to write down: 1. What is the name of the variable? 2. What is its initial value? 3. What will its value be after the code runs?

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teach variables by modeling live mutations in front of students, narrating why each change matters. Avoid metaphors like boxes—students need concrete evidence that variables are memory locations holding changing data. Research shows that students grasp mutability faster when they debug their own errors, so plan for safe, scaffolded missteps. Emphasize naming as part of design, not decoration, by requiring students to justify their labels during peer reviews.

By the end of the lesson, students will confidently declare variables with meaningful names, assign appropriate data types, and modify values during execution. They will explain why clear naming and type awareness matter for program clarity and function. Observations of their debugging and naming choices will show growing independence.


Watch Out for These Misconceptions

  • During Pairs Coding: Score Tracker, watch for students who assume the variable holds a fixed value and do not update it during the loop.

    Pause pairs midway and ask them to verbalize the current value of their score variable before and after the update block; prompt them to trace the flow step-by-step.

  • During Variable Naming Relay, watch for students who rename variables without considering clarity or collaboration.

    Require each group to present their new names and justify them to the class, highlighting how poor names make code harder to maintain.

  • During Prediction Demo, watch for students who assume any data can be stored in any variable regardless of type.

    Show a string-in-number error in the demo, then have students predict what will happen before running the block and discuss how Scratch enforces types.


Methods used in this brief