140 likes | 154 Views
Engage in interactive off-screen activities to grasp fundamental programming concepts like variables and assignments. Develop a strong mental model to ensure comprehension. Access resources and support on the Teaching London Computing website.
E N D
Box Variables Prof Paul Curzon Queen Mary, University of London With support from Google, D of E and the Mayor of London www.teachinglondoncomputing.org Twitter: @TeachingLDNComp
Aims • Give you deeper understanding of core topics • Getting started programming • Variables: declaration and initialisation • Assignment • Sequencing and flow of control • Give you practical ways to teach computing in a fun, thought provoking way • away from computers, focus on concepts • Linked activity sheets and booklets can be downloaded from our website: www.teachinglondoncomputing.org
Variables and assignment • One of the first big hurdles students face when learning to program is understanding how variables and assignment work. • If they do not understand this they will not get any further. • It is very easy to misunderstand! • It is very easy to fix!
Running programs physically • A really good way to build a deep understanding of programming constructs is to act out the program • Compile the program on to people! • They follow the instructions • Makes abstract ideas visible and tangible
Variables as boxes • Variables are like storage boxes • Special ones that can • Store • Create • Destroy
A swap program What does this (python) program do? colour1 = “red” colour2 = “green” temp = colour1 colour1 = colour2 colour2 = temp Let’s act it out!
Main points The main points this activity illustrates are: • Variables have names • so the computer knows which one is meant. • Variables hold values • the actual data that is being stored. • Do not confuse variable names with their values! • A variable can only store one value at a time. • When accessing a variable’s value you make a copy • that variable’s value is untouched. • When you store a value in a variable you destroy anything that was previously there.
Is this a swap program? What does this program do? colour1 = “red” colour2 = “green” colour1 = colour2 colour2 = colour1
Paper dry run • As a follow up exercise dry run simple programs on paper • Make sure everyone understands • Fix anything anyone has misunderstood
Faulty mental models(1) Watch out for the following common misunderstandings: • a variable still holds its original value after an assignment, • assignment works by copying left to right, • a sequence of assignments all happen together • a sequence of assignments can happen in any order
Faulty mental models(2) Watch out for the following common misunderstandings: • both left hand side and right hand side change • assignment is like a mathematical equality just making both sides the same • after an assignment future changes to one variable change the other • variable can hold all the values ever assigned to it
Summary Programming can be introduced in fun ways away from a computer • Variables and assignment are key early topics • Important to • get the mental model right • fix if not!
More support On our website to support this session: • Activity sheets • Story sheets • Slides Details of more worskshops/courses • free unplugged sessions • subsidised courses (e.g. GCSE programming) www.teachinglondoncomputing.org Twitter: @TeachingLDNComp
Together we areTeaching London Computing Thank you! www.teachinglondoncomputing.org Twitter: @TeachingLDNComp