Part III: Coding is in the details
Updated: Mar 5
School exams can be strict, with marks being taken off for tiny mistakes like misspellings, incorrect grammar, forgotten numbers, and so on.
“Why all the fuss?” – a question we’ve all asked ourselves at some point.
Well, often the devil is in the detail. As we grow up, we start to truly appreciate that success and failure are often determined by the details. Small mistakes like a typo in an important email to a client, or an incorrect number in a finance spreadsheet, can have serious consequences.
It’s hard to explain these consequences to kids without triggering fear or frustration. It’s even harder to design a good exercise to train kids’ attention to detail without hampering their creativity. Once again, this is where coding can help.
Transferrable skill #3: Attention to detail
Coding is an excellent exercise to train kids’ attention to detail. Almost all programming languages are sensitive to ‘syntax errors’ such as misspellings, missing symbols, and unfinished lines of code. Syntax in coding is just like grammar in English. In the same way that we know when to use a comma or a fullstop when we write a sentence in English, syntax tells us what the rules are when we use different symbols and words to write code in a specific coding language. When our syntax is wrong, our code doesn’t work. Fear not, however, as almost all programming tools give us hints when an error does occur due to our syntax being incorrect. These error messages will tell us in which line of code the error occurred, if there is something missing or duplicated, or whether the logic of our code makes sense. Through writing up code and fixing the errors (a.k.a. debugging*), kids can learn to focus on the detail and see for themselves the importance of working carefully (otherwise their code won’t work for them!)
a. During the Sonic Pi activity you did in Part 2 of this series, did you notice what happened when your code had an error? How did you find out where the error was?
b. When you do coding at school, what kinds of errors have you found in your code before? How did you fix them? Was it easier to fix them when you saw a similar error again?
The process of finding and fixing errors in your code is called “debugging”. This word has an interesting story behind it. Back in 1945, Admiral Grace Hopper (a super impressive female computer scientist!) and her colleagues were trying to find out why their huge computer stopped working. They spent a long time checking everything, until finally Hopper found a moth stuck on one of the circuits and declared “I found a bug”. That’s why coders call the errors in their code “bugs”.
Searching for bugs in code can be a bit like a scavenger hunt. Teaching kids to look at code like they would look at an adventure in search of something wonderful is a great way to empower them with enthusiasm for the details. Learning to work slowly and carefully is a skill that will benefit kids for the rest of their lives. Tune in next week to hear about another skill coding can teach us.
- Dr Christine Yu & Lexi Hayden