Friday 11 November 2016

Making Mistakes on Purpose when learning to Code

Within my school board (Trillium Lakelands District School Board) we have taken on a board-wide coding initiative. Last year, one junior classroom (grade 4-6) from each school within our board was part of the coding initiative.

Part of the initiative was going into classrooms and working with classes and teaching some basics of coding. Often, when guiding some beginners in coding (outside of a environment like code.org), it can be easy to fall into a live guided coding session. It can be hard to get students to think about what they are doing when they are following a guided lesson.

A strategy to get students to engage in some thinking, is to purposely guide them to make a mistake and then have them think about why something is or is not happening the way that that they expected. For example, in our first lesson, I will start by having students start with a  and I have students click on it several times to see what happens. I then ask students to try to figure out how to make the sprite move forwards and then backwards, by using the same block BUT change something about the number. Students eventually suggest making the block 
and then they connect the two blocks togetherAND..... nothing happens. The next step of asking students  "WHY" is when you can start to engage student's thinking skills ~ the purpose of coding (not just following a teacher as they follow along). An easy way to solve the about issue, once experienced, is to add in a "play sound.." or a "wait <> seconds" block to slow down the process and allow the movement to be seen.

Another example of purposeful mistakes in coding is in an activity where you code 2D shapes. First start by brainstorming the characteristics of a square. Students will likely say: 4 sides, 4 corners, all sides the same length, 90 degree angle corners...etc. Work together with students to code the drawing of a square. Your code may look like:

Now ask students to brainstorm the characteristics of an equilateral triangle. Likely they will say that it will have 3 equal sides, 3 angles and the angles are 60 degrees. Use that information to code the triangle. Let students take the lead in changing the code. Don't guide as much through this. Once they run their code, it will likely look and perform like this:
Now this thinking can start. Consider having a couple triangles taped to the floor and have students physically walk the triangle. They should realize through visualization and observation, that they are turning much more than 60 degrees. Discuss that 60 degrees is the interior angle of the triangle, and when they code the movement for drawing, they need to use the exterior angles. The formula for determining the exterior angles for a regular shape is 360 degrees divided by the number of sides (as explained here).

Mistakes are a huge part of learning. Help foster strong thinking skills in our students by allowing them to make mistakes (even if on purpose), and then work through them. Coding is about thinking, not just following recipes.