understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions.
create and debug simple programs
LO: To debug simple programs.
There are two main bugs (errors) that children will encounter when writing code: the first is usually caused by a spelling or typing error and will be pointed out by Reeborg. The second type of bug can be more tricky, it is when the program runs without an error but the result is not what was expected - Reeborg is not in the correct finishing poition for example.
Lets consider the first type of error:
#Year group or class #name #date #Alone move() move() move() move() turnleft()
This code brings up the following error message:
These errors are known as syntax errors and are usually caused by incorrect spelling or typing mistakes - here the error is caused because the command turn_left() is missing an underscore.
The second type of error occurs when either the commands are incomplete or in the wrong order - it is also worth considering that the pupil has misunderstood the task so the commands do not match the task outcome.
Reeborg has a handy tool for debugging these types of errors.
Next to the play/go button is the step command. This will run your code one line at a time so you will be able to see where your commands are in the incorrect order or where too many move() commands make you crash into the wall.
For this lesson you might want to give the children flow charts that contain the wrong instructions or use some of the Token world debugging files available below in the code examples.