C3.2 Read and modify given codes, including codes with sequential events and simultaneous events, and describe the impact of these changes on outcomes in a variety of contexts.

Skill: Reading Code


Code reading involves interpreting blocks or commands to deduce the meaning of the code. This allows the student to make predictions related to the behaviour of the code. Code reading is also an important part of debugging, the identification and correction of errors in the code. By reading the code, it is possible for the student to identify the reason(s) why it is not working. Note that this skill does not correspond to the computer reading the code, but rather to the student reading the code to verify it.

For example, the student could be presented with code for two sprites that are having a "race". The student would first have to predict which sprite would win the race. Here is an example of code:

Sprite butterfly. Start on green flag, move up two times, move right 4 times, 4 down 3 times, move right 6 times, move up two times, move down two times, move right 3 times, move up 3 times, move right one time, move up one time, move right two times, move down two times, move right two times, move up 3 times, move left one time, move down two times, move right one time, say ‘I’, end. Sprite butterfly. Start on green flag, move up two times, move right 4 times, 4 down 3 times, move right 6 times, move up two times, move down two times, move right 3 times, move up 3 times, move right one time, move up one time, move right two times, move down two times, move right two times, move up 3 times, move left one time, move down two times, move right one time, say ‘I’, end.


At first glance, one of the two codes appears to have more moves, but upon closer reading of the code, it is possible to see that some blocks represent more than one move. The student will need to understand this element of the code syntax first in order to make their prediction.

Skill: Modifying Code


The culture of computer programming is one of sharing. Many programs are created based on existing code. Modifying code allows the student to start from an existing and functional code sequence in order to build something new. Modifying code can also be done to simplify it or to show that there is more than one way to represent the same situation using code. If necessary, the student can also modify erroneous code to make it functional, a process called debugging.

Using the two butterflies code above, it would be possible to have the student modify it so that both butterflies finish the race in a tie. This does not necessarily mean that both butterflies make the same movements, but rather that the number of movements of one butterfly will be reduced or the "wait" block will be used to give the slower butterfly a chance to catch up to the other butterfly.

Skill: Describing the Impact of Changes on Code


Trial and error learning is an important part of creating code patterns. However, it is important that the student be able to justify their choices of modifications to an existing code by making predictions about the effect of the changes on the behavior of the code.

Using the recording features of coding software allows the student to add audio blocks describing their block choices, during an activity in which the student must modify the provided block to achieve a specific goal.

Bloc of sound recorded by user.

Knowledge: Simultaneous Events


Simultaneous events are simply events that occur at the same time. Note, however, that events do not have to be identical to be considered simultaneous.

A common example of the use of simultaneous events is diagonal movement. Most block coding and robotics software allows movement in four directions (for example, up, down, left, right), but a diagonal move requires both a horizontal and a vertical move at the same time.

Let's take, for example, the following imaginary city:

Cartographic image of a village.

The student could be given the code below to predict the final location of the sprite if the initial location is well defined. In this example, the sprite would begin its journey at the police station and end at the school.

Start on green flag, move right 6 times, move up two times, send message. Start on message, move right 4 times. Start on message, move right 4 times.


This code contains two simultaneous starting situations, the receipt of the message which is symbolized by the orange envelope. The student could then have the task of modifying the code so that the sprite goes from the hospital to the store or makes any other diagonal movement.