1 / 14

Box Variables

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.

francined
Download Presentation

Box Variables

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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

  3. 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!

  4. 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

  5. Variables as boxes • Variables are like storage boxes • Special ones that can • Store • Create • Destroy

  6. A swap program What does this (python) program do? colour1 = “red” colour2 = “green” temp = colour1 colour1 = colour2 colour2 = temp Let’s act it out!

  7. 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.

  8. Is this a swap program? What does this program do? colour1 = “red” colour2 = “green” colour1 = colour2 colour2 = colour1

  9. Paper dry run • As a follow up exercise dry run simple programs on paper • Make sure everyone understands • Fix anything anyone has misunderstood

  10. 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

  11. 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

  12. 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!

  13. 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

  14. Together we areTeaching London Computing Thank you! www.teachinglondoncomputing.org Twitter: @TeachingLDNComp

More Related