12
© Boardworks Ltd 2013 1 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable) Useful web links in the Notes Page Icons: Unit 9 Computing Concepts Worksheet or support sheet available

© Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

Embed Size (px)

Citation preview

Page 1: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20131 of 12

9.1 Programming basics

Teacher’s notes in the Notes Page

Flash activity (these are not editable) Useful web links in the Notes PageIcons:

Unit 9 Computing Concepts

Worksheet or support sheet available

Page 2: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20132 of 12

Curriculum links

This presentation supports the following areas of knowledge in the Naace Curriculum Framework for KS3 ICT:

This presentation supports the following sectionsof the Draft Programme of Study for KS3 Computing:

explain how instructions are stored and executed within a computer system.

use two or more programming languages, one of which is textual, each used to solve a variety of computational problems; use data structures such as tables or arrays; use procedures to write modular programs; for each procedure, be able to explain how it works and how to test it.

Technical Understanding – Programming and control

Page 3: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20133 of 12

Learning objectives

By the end of this presentation we will have learned:

to understand how computers process code (instructions)

to recognize the difference between constants and variables

to create simple IF statements

to understand control flow.

Page 4: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20134 of 12

Programming basics

Computers will only do what you tell them to. If a program doesn’t work, you haven’t given it the right instructions!

In order to program a computer, you need to speak in a language that it understands. There are many different programming languages, but their basic concepts are the same.

Page 5: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20135 of 12

Robby the robot

Page 6: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20136 of 12

Common elements of programming

Constants stay the same throughout the running(or execution) of the program.

When the user moves the character, it always moves at the same speed.

variablesconstants control flow.

In order to start programming we need to understand some of the common elements of all programming languages:

An example of a constant might be the speed of a character.

My speed is set to 11.

My speed is set to 5.

Page 7: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20137 of 12

Constants

Another example of a constant is when a user is asked to enter their name at the beginning of a game.

The name ‘Sam’ stays the same throughout the game.

Page 8: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20138 of 12

Variables

Variables store values that change throughout the execution of a program. They can hold any value; it could be a calculation, a response or something else.

1 + 1a =

the number that will be stored in ‘a’

the name of the variable

First we will look at variables that store calculations. Look at the example below:

tells the computer that we want to assign something to ‘a’

Page 9: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 20139 of 12

Variables in games

A variable changes throughout the execution of the program depending on different conditions.

If you gain 10 points for every target you hit, the variable will change by 10.

Here is a variable called ‘score’. At the beginning of the program it holds the value 0.

For example, the score in a game changes often. It will start at 0 and then increase at different stages.

score = 0

Page 10: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 201310 of 12

Variables in games

The pseudocode for adding 10 to the variable ‘score’ is this:

score = score + 10

This means add 10 to whatever number is in ‘score’.

This is pseudocode,a way of planning out our code before converting it

to the chosen programming language.

Page 11: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 201311 of 12

Assigning numbers to variables

Look at the variable assignment statement below.

If a calculation is assigned to a variable then the variable always contains the answer, not the calculation.

b = 4 * 3

b = 12

The answer is:

What number has been assigned to ‘b’?

Page 12: © Boardworks Ltd 20131 of 12 9.1 Programming basics Teacher’s notes in the Notes Page Flash activity (these are not editable)Useful web links in the Notes

© Boardworks Ltd 201312 of 12

What is the value of the variable?