Introducing code to a child

Antonio D'souza
2 min readMay 14, 2020

--

After explaining to our 5YO how files work & letting her play around with them for a few days, I decided to expose her to coding. When I was a kid I loved using a language called Logo to move a turtle around the screen & make it draw lines. There are very few Logo implementations around today & most of them require a web browser! But I didn’t even have X installed on the laptop our daughter has been using so that wasn’t going to work.

Eventually I found exactly what I needed: KTurtle, which can run directly on EGL! First I showed our daughter how to use the forward (fw) command to draw lines by moving the turtle forward on the canvas by a specified number of pixels. The I showed her how to turn the turtle to the left (tl) or right (tr). This allowed her to draw simple shapes like a square or triangle, although she doesn’t understand enough geometry to know which angles to use so I computed those for her on a diagram.

I had her pretend to be the turtle as she walked around the room following her own coded instructions so she could debug them. She got to practice her newfound arithmetic skills. It was great!

Then I introduced a couple of aesthetic niceties like changing the thickness of the turtle’s pen using the penwidth (pw) command and changing its colour (pc). The latter command requires specifying the desired colour in RGB but, fortunately, we had already taught her about mixing colours, so she had no trouble understanding that part, although I was glad she didn’t think to ask why the maximum possible value for each was 255.

She wanted to draw a flower so I taught her the syntax for a loop in Logo. She’d already been exposed to the concept in the books we’d been reading earlier so the hardest part for her was spelling “repeat”. I was a bit concerned that the curly braces used for scoping the loop body would confuse her but she seemed to take those in stride, understanding that whatever was between them would be run in the loop.

Things had been going so well that I figured I may as well experiment with using variables. I defined a new variable and used it to specify the number of loop iterations. Then I asked her how many times the loop would run & she guessed correctly. I didn’t want to push my luck so I decided to stop introducing new concept at this point and let her experiment.

--

--

Antonio D'souza
Antonio D'souza

No responses yet