Session 6

Learning targets

I am learning to debug an algorithm

  • Play the video above which shows what happens when there is a bug in an algorithm. Can the children describe what they think debugging is?

  • Ask the children to work in pairs. Hand a copy of the 'bug cartoons' (below) to each pair. The sheet shows everyday algorithms that have gone wrong. The children spot these bugs in their pairs.

  • Discuss as a class how they could fix the algorithm so that it runs properly

  • Challenge the children to think of any other examples of bugs, like putting clothes on in the wrong or making a bowl of cereal without placing out a bowl first


Key questions

• What bugs are in the cartoons?

• How can they be debugged so that the algorithm works again?

• Can you imagine an everyday algorithm with a bug? How would we fix it?

Bug swatting!

  • The children are going to use decomposition and debugging skills to solve problems with directions (algorithms) intended to guide them between two areas of a map. Unfortunately, the person who wrote the directions wasn’t very good at reading maps and there are lots of ‘bugs’ (mistakes) in the directions (algorithms)

  • Using 'Maps with landmarks and paths', organise the children into groups of five

  • The children should be familiar with these types of directions from their work with Bee Bots

  • Encourage the children to use the direction cards to remind themselves of the direction symbol and to help solve the problems

  • In their groups, the children go from table to table solving the bugs. The children need to:

• Work out where the algorithm went wrong.

• Cross out the incorrect direction.

• Write in the correct direction to show how the algorithm should be changed to make it work.

  • Each time the children move to a new table, collect their amended algorithms and then put out a

fresh copy of each set of directions on the tables for the next groups


Key questions

• How can you debug the algorithm?

• What was causing the bug?