Variables in Programming: Diving Deep into Concepts and Teaching Methods

 
Session 5
Variables
 
 
Teaching Primary Computing
Diving Deep into Programming
 
Course outline
 
Days outline
 
Objectives of this session
 
Increase understanding of variables specifically:
 
What is a variable
analogy misconceptions
initialisation
data types
data structures
scope
Using design to represent variables
Progression of variables
Roles of variables
 
 
 
Variables
 
1.
What is a variable?
 
2.
How do you 
teach
 variables - what analogy do you use – what misconceptions
are associated with this approach?
 
3.
What are data types, data structures and what is scope?
 
4.
How might we represent a variable in a design or algorithm?
 
5.
What 
techniques/ commands
 are often used to implement (code) variables?
 
6.
What might the 
progression 
of these variables be?
 
7.
What are the roles of variables?
 
 
 
 
A variable is a simple way of storing one piece of information somewhere in the
computer’s memory whilst a program is running, and getting that information back
later.
1.
What is a variable?
Variables
Programs store, retrieve or
change the value of a
variable.
Box analogy
Create a variable (declare) - make and label the
box.
Set values, store values, change values, update
values
-
put values in the box.
Select, retrieve, get values
-
look in the box.
Variables
What
misconception
can pupils have
about this step?
2 How do you 
teach
 variables- what analogy do you use –
what misconceptions are associated with this?
 
3. What are data types, data structures and what is scope?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Variables
D
a
t
a
 
s
t
r
u
c
t
u
r
e
s
:
 
v
a
r
i
a
b
l
e
s
,
 
a
r
r
a
y
s
,
o
r
d
e
r
e
d
 
l
i
s
t
s
,
 
t
a
b
l
e
s
,
 
g
r
a
p
h
s
.
D
a
t
a
 
t
y
p
e
s
:
 
n
u
m
b
e
r
s
,
 
t
e
x
t
,
 
y
e
s
/
n
o
.
.
.
Scope: local, global
4. How might
variables be
represented
by pupils as
an 
algorithm
/design?
Variables
 
Do you have better examples?
 
variable
 
variable
 
Variable algorithm
 
Variable algorithm
Variables
 
5. What
techniques/
commands
are often used
to implement
(code)
variables?
Variables
 
5. What
techniques/
commands
are often used
to implement
(code)
variables?
Variables
 
5. What
techniques/
commands
are often used
to implement
(code)
variables?
Why is this so
important?
 
Variables to gather and display a value
 
https://scratch.mit.edu/projects/167162449/
 
 
Score algorithm
 
Set to 0 at the start
 
Add 1 when answer is correct
 
Take away 1 if wrong
 
At the end show a ‘Well
done’ message with the score
but if they got less than 5
points say ‘Oh dear’
 
Add a score to your quiz.
 
1.
Where will you set/reset it?
2.
Why display it throughout the quiz?
3.
Can you break your quiz?
Test data
text,control characters, numbers (+,-,0)
null value
Maximum/minimum values
        (How can you record your tests?)
 
If you did not create a quiz - use this one to get
you started.
 
Activity 1
Live coding
 
Variables for users to control aspects of program
 
Explore this program.
https://scratch.mit.edu/projects/167543312/
 
What have you discovered?
Why did I include certain things?
What did I want you to learn?
 
Activity 2
Guided
exploration
 
Variables - to control a program to
increase efficiency/reuse/understanding
Problem
Make a number bond to 20
quiz for a year 2 class to
practise there mental maths.
 
Quiz algorithm
Ask 4 addition questions
where the total is less than
20.
If the answer is correct add 1
to the score, but if it is wrong
say ‘Sorry the answer was..’
At the end give the player
their total score.
 
Using variables for other roles.
 
 
In this maths quiz how have variables been used?
Why?
1.
Predict what the code will do
2.
Run it. Were you correct?
3.
Remix the code
Add 4 subtraction questions
Add 4 multiplication questions
4.
What will you do for the end of game message?
 
Extension: Compare the cat and bat code.
 
 
https://scratch.mit.edu/projects/96144555/
 
Activity 3a/b
Exemplar code  - predict
and remix
 
Variables - to control the flow of program
Problem
Make a number bond to 20
quiz for a year 2 class to
practise there mental maths.
 
Let the user control how easy
or hard the questions are.
 
How can variables be used to control flow?
 
Look at the two programs
Maths quiz easy hard (1)
https://scratch.mit.edu/projects/167515468/
Maths quiz easy hard (2)
https://scratch.mit.edu/projects/167515528/#player
Predict first what each program will do before you
run them.
What has been added to control how easy or hard
the quiz is?
What do you think to the differences?
What is the impact of make your own blocks?
 
 
Activity 4a/4b
Exemplar code
and predict and
Comparison
(targeted task)
Progression in variables 
 (ideas to spark discussion only)
Animations/stories
Games
Physical computing e.g. Makey, makey, Lego Wedo, Picoboard, TTS controller/LED etc….
Quizzes
Use variable to:  Control
internal working of the
program e.g. difficulty level
Use variable to: Display a value
that changes during the program
e.g. score/lives
Can create a
variable
Can use
variables
Can initialise a
variable
Context
Use
Knows what a variable is, can predict what variables will do, can change code with variables, can add a variable….
Independance
Use variable to:  Facilitate user to
control an aspect  of a program
e.g. difficulty/ speed/size/colour
Simulations
Can update
variables
Can exhaustively
test variables
 
1.
Gatherer – e.g. score
2.
Transformation – e.g. sum answer
3.
A flag or choice – e.g. hard or easy choice, task complete yes/no
4.
Most wanted holder – e.g. best score
5.
Fixed value – e.g. number of questions
6.
Temporary – like Scratch answer
 
 
The role of variables
.
Use variable to:  Control
internal working of the
program e.g. difficulty level
Use variable to: Display a value
that changes during the program
e.g. score/lives
(or over time – cloud variables)
Use variable to:  Facilitate user to
control an aspect  of a program
e.g. difficulty/ speed/size/colour
 
7.
Most recent answer – the last value in a succession
8.
Follower  - based on another variable
9.
Organizer - to do with reorganised arrays
10.
Stepper – to control a loop
 
 
Objectives of this session
 
Increase understanding of variables specifically:
 
What is a variable
analogy misconceptions
initialisation
data types
data structures
scope
Using design to represent variables
Progression of variables
Roles of variables
 
 
 
 
Imitate
Innovate
Invent
Vs
Remix
Slide Note
Embed
Share

Delve into the world of variables in programming with a focus on definitions, teaching strategies, data types, structures, and scope. Explore misconceptions, analogies, design representations, and roles of variables to enhance understanding and application in coding. Discover practical examples and techniques for implementing variables in algorithms while considering progression and student engagement.

  • Programming Concepts
  • Variables
  • Teaching Strategies
  • Data Types
  • Misconceptions

Uploaded on Aug 12, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Teaching Primary Computing Diving Deep into Programming Session 5 Variables

  2. Course outline Day 1 Day 2 Day 3 Pedagogy, Sequence, Repetition Selection, Variables, Make your own blocks Control/Physical Computing Planning & Assessment

  3. Objectives of this session Increase understanding of variables specifically: What is a variable analogy misconceptions initialisation data types data structures scope Using design to represent variables Progression of variables Roles of variables

  4. Variables 1. What is a variable? 2. How do you teach variables - what analogy do you use what misconceptions are associated with this approach? 3. What are data types, data structures and what is scope? 4. How might we represent a variable in a design or algorithm? 5. What techniques/ commands are often used to implement (code) variables? 6. What might the progression of these variables be? 7. What are the roles of variables?

  5. Variables 1. What is a variable? A variable is a simple way of storing one piece of information somewhere in the computer s memory whilst a program is running, and getting that information back later. Programs store, retrieve or change the value of a variable.

  6. Variables Box analogy Create a variable (declare) - make and label the box. Set values, store values, change values, update values - put values in the box. What misconception can pupils have about this step? Select, retrieve, get values - look in the box. 2 How do you teach variables- what analogy do you use what misconceptions are associated with this?

  7. Variables 3. What are data types, data structures and what is scope? Data types Data types: numbers, text, yes/no... Data structures Data structures: variables, arrays, ordered lists, tables, graphs. Scope: local, global

  8. Variables Do you have better examples? 4. How might variables be represented by pupils as an algorithm /design? variable variable variable variable Variable algorithm Variable algorithm variable variable variable variable Variable algorithm Variable algorithm

  9. Variables 5. What techniques/ commands are often used to implement (code) variables?

  10. Variables 5. What techniques/ commands are often used to implement (code) variables?

  11. Variables 5. What techniques/ commands are often used to implement (code) variables? Why is this so important?

  12. Variables to gather and display a value Add a score to your quiz. Activity 1 Live coding Score algorithm 1. Where will you set/reset it? 2. Why display it throughout the quiz? 3. Can you break your quiz? Test data text,control characters, numbers (+,-,0) null value Maximum/minimum values (How can you record your tests?) Set to 0 at the start Add 1 when answer is correct Take away 1 if wrong At the end show a Well done message with the score but if they got less than 5 points say Oh dear If you did not create a quiz - use this one to get you started. https://scratch.mit.edu/projects/167162449/

  13. Variables for users to control aspects of program Activity 2 Guided exploration Explore this program. https://scratch.mit.edu/projects/167543312/ What have you discovered? Why did I include certain things? What did I want you to learn?

  14. Variables - to control a program to increase efficiency/reuse/understanding Problem Make a number bond to 20 quiz for a year 2 class to practise there mental maths. In this maths quiz how have variables been used? Why? 1. Predict what the code will do 2. Run it. Were you correct? 3. Remix the code 4. What will you do for the end of game message? Activity 3a/b Exemplar code - predict and remix Using variables for other roles. https://scratch.mit.edu/projects/96144555/ Quiz algorithm Ask 4 addition questions where the total is less than 20. If the answer is correct add 1 to the score, but if it is wrong say Sorry the answer was.. At the end give the player their total score. Add 4 subtraction questions Add 4 multiplication questions Extension: Compare the cat and bat code.

  15. Variables - to control the flow of program Activity 4a/4b Exemplar code and predict and Comparison (targeted task) How can variables be used to control flow? Problem Make a number bond to 20 quiz for a year 2 class to practise there mental maths. Look at the two programs Maths quiz easy hard (1) https://scratch.mit.edu/projects/167515468/ Maths quiz easy hard (2) https://scratch.mit.edu/projects/167515528/#player Predict first what each program will do before you run them. What has been added to control how easy or hard the quiz is? What do you think to the differences? What is the impact of make your own blocks? Let the user control how easy or hard the questions are.

  16. Progression in variables (ideas to spark discussion only) Animations/stories Quizzes Context Games Simulations Physical computing e.g. Makey, makey, Lego Wedo, Picoboard, TTS controller/LED etc . Use variable to: Facilitate user to control an aspect of a program e.g. difficulty/ speed/size/colour Use variable to: Display a value that changes during the program e.g. score/lives Use variable to: Control internal working of the program e.g. difficulty level Use Knows what a variable is, can predict what variables will do, can change code with variables, can add a variable . Can initialise a variable Can update variables Can use variables Can exhaustively test variables Can create a variable Independance

  17. The role of variables. Use variable to: Facilitate user to control an aspect of a program e.g. difficulty/ speed/size/colour Use variable to: Display a value that changes during the program e.g. score/lives (or over time cloud variables) Use variable to: Control internal working of the program e.g. difficulty level 1. Gatherer e.g. score 2. Transformation e.g. sum answer 3. A flag or choice e.g. hard or easy choice, task complete yes/no 4. Most wanted holder e.g. best score 5. Fixed value e.g. number of questions 6. Temporary like Scratch answer 7. Most recent answer the last value in a succession 8. Follower - based on another variable 9. Organizer - to do with reorganised arrays 10.Stepper to control a loop

  18. Objectives of this session Increase understanding of variables specifically: What is a variable analogy misconceptions initialisation data types data structures scope Using design to represent variables Progression of variables Roles of variables

  19. Levels of abstraction 1. Task 2. Design (including algorithms) 3. Code 4. Running the code Copy code Targeted tasks Shared coding Guided exploration Project design and code Tinker Vs Imitate Innovate Invent Remix

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#