Getting Kids Into Coding
I work in software development, and I’ve loved experimenting with computers for nearly 40 years. I don’t think that everyone should become a developer, just like I don’t think that everyone should become an author, painter, accountant or musician… but I do think that everyone should have the opportunity to explore coding, ideally from an early age.
Some of the many benefits for the children being:
- Creative Expression
- Logical Thinking
- Problem solving
- It's damn good fun
Where to Start?
You could read up on the classics of education theory: Piaget, Vygotsky and Bruner, but my summary is:
Go from where they are to where you want them to be. Go from the concrete to the abstract.
Along with a few lines from Dorothy Nolte:
"...If a child lives with praise, they learn to appreciate. If a child lives with encouragement, they learn confidence...."
Growing self-confidence, and enabling a child to feel that they are in an encouraging and safe environment, in which they are able to explore and make mistakes, is an essential foundation for all learning and development activities, whatever you are trying to achieve.
If you believe you can, or you believe you can’t, you are probably right. (Henry Ford).
Start simple - make it work, then add complexity. Start where they are comfortable, then draw them out into new areas.
Be actively on the lookout for any spark of interest, be it music , art, games, maths, and use these to draw them into coding. I’ve been running coding clubs in Primary Schools for 4 years (I’m also a former High School Physics Teacher), and have children aged 10 & 7 both of whom have enjoyed exploring coding in various forms - the examples below are drawn from these experiences:
For children who already love painting and sketching - coding presents the opportunity to bring those paint-brushed and pencil-drawn worlds and characters to life. So maybe start with sketches of the characters, then work with them to bring them into the game. Using a mouse, or trackpad to sketch can be quite frustrating at first, especially as there tends to be an initial drop in visual quality of their work as they adjust - but the excitement returns once they see their work start to come to life digitally, so you may need to encourage them to push through.
They subsequently learn more about what the digital characters can do, maybe starting to animate them, having them interact with other characters, or developing worlds in which they can explore. This often forms a positive feedback loop, with children then further exploring and sketching richer, more dynamic characters and environments, before translating them into digital form again.
One Year 5 (aged 9) pupil continued exploring at home, and created a staggering Sims-like game created in Scratch, where her character could interact with a world of her making. Including interacting with other in-game characters, currency which could be used to pay to go to the cinema, and large multi-environment game map.
Note: If you’re not familiar with Scratch, it’s a visual programming environment created by M.I.T. . There are some other great tools which offer similar functionality, but Code Club developed a superb set of projects based on Scratch, which I’ve used extensively, and has been incredibly effective for the children in my clubs. For inspiration or to contribute : the Code Club projects are managed on Github: https://github.com/CodeClub/
I’ve heard from parents that their children were arranging sleepovers including building games in Scratch together. Self-guided junior hackathons!
For children who are avid readers, this can be a way to bring their books to life, guiding them to translate some aspect of their favourite book into digital form. Below is a game involving Hiccup Horrendous Haddock III trying to escape a Bouldertail Dragon, inspired by Cressida Cowell's epic 'How to Train Your Dragon'
In this instance, we used an app called Carbo to created flattened digital images of their pencil drawings, and then use a paint package to apply colour and transparency to graphic before importing as a sprite.
For pupils who enjoy Maths, codifying their existing knowledge can be a fantastic vehicle to help them discover further patterns in maths, which often leads to a deeper understanding. The projects need to be tied into the appropriate level of maths for the individual pupils, but we've seen projects (in Scratch, and Python) such as:
- find all prime numbers up to 200
- Draw an N sided shape (using a few lines of code as possible)
Interestingly, children often enjoy the challenge of setting their own challenges for their classmates. Such as this maths multiplication quiz written in Scratch - they then self-differentiated, by adding further challenges like a timing element, or adaptive quizzes where as you get more answers correct, the questions get harder.
Music is a great driver for people of all ages, especially children. In Scratch there are built-in libraries of instruments, sounds and noises, and you can also use a microphone to record sounds which can then be employed in your projects. This can lead to some of the noisiest and most entertaining club sessions. Notably, in one session a group of children sampled some AC/DC (Thunderstruck) which led some exceedingly 'attention grabbing' projects... passing pupils came to see what was going on, which led to a wave of additional pupils being interested in joining the club.
Sonic Pi : is 'The Live Coding Music Synth for Everyone', and while the syntax can be a little challenging to get started with, can produce some phenomenal results : https://vimeo.com/110416910
Linda Sandvik talked about the Makey Makey in a previous 12devs article and we've used these to great effect to extend the way that the children interact with their creations, by enabling external objects (such as bananas) to become an input device into the computer.
We had a group of pupils combine their own audio samples, with interesting (partially-conductive) objects from around the classroom to make some captivating and entertaining musical installations, which again drew in further pupils who wanted to join in.
Exploring interactions between the physical and digital worlds is something that I find particularly interesting, and also a great source of inspiration for lots of children.
Other ways we've explored for crossing the digital/physical divide, include things like the Leap Motion Controller which senses your hands moving naturally in 3D, and feeds that data into the computer for an extremely intuitive input mechanism. (you'll see further examples below when we talk about Raspberry Pi’s GPIO and rf-controllers.)
Or Lego Mindstorm, which is a programmable Lego robot model, with sensors and motors, which you can program using Lego’s own drag and drop coding interface.
Minecraft is an amazing sandbox video game popular with a lot of the older primary school children. They love creating their own structures, or challenges (for example parkour) which they then set for their friends to try to complete.
One of the many fantastic aspects of the Raspberry Pi (RPi) is that the standard OS (Raspbian) includes a free version of Minecraft and is ready setup with a Python API to interact with the game. Learning that they can start to programmatically interact with those objects and worlds is tremendously exciting for children, and can be the perfect gateway to introduce them to the Python programming language.
After all, who doesn't want to be able to make lava fall from the sky, or programmatically generate ginormous structure made entirely from TNT:
Adventures in Minecraft is a brilliant book helping children explore the Python API for Minecraft. (It states it's aimed at 11-15 year olds - but with some guidance, we've had 9/10 year olds find it really valuable.)
This can often lead to children being interested in exploring Python further, which then can take into more abstract activities such at interacting with Web Service Data via Python.
The Raspberry Pi
There are myraid 'system-on-a-chip' solutions (such as Arduino, BeagleBone Black, Intel Edison and many more), offering low price computing power in an accessible package, and if you have access to one of these then they can certainly be fantastic to learn with. However, the Raspberry Pi seems to innately cause excitement with children, or at the least curiosity. One of the great things going for the 'Raspberry Pi' seems to be it's name - it feels accessible, and I think pupils are very happy being opening excited talking about the Raspberry Pi, without it sounding too geeky.
The Raspberry Pi was setup with education in mind, and I think squarely hit the nail on the head - if you install the default OS (Raspbian) it comes pre-installed with Scratch, Sonic Pi, and a free version of Minecraft already setup to be used with the Python API. There is an incredible community surrounding the RPi, and an amazing array of accessories, kits (such as the CamJam EduKit) and projects including the epic Astro Pi.
Astro Pi is a Raspberry Pi, with Sense HAT (a HAT is an add-on which slots onto the RPi), in a specially constructed flight case, which is now in-situ in the International Space Station.
(Image Source: https://www.raspberrypi.org/blog/watch-tim-peake-astro-pi-flight-units-in-space/ )
There were even competitions aimed at School children, where the winning entries became part of the Astro Pi payload that was launched to the International Space Station.
I don’t think I’ve yet met a single child in any of the clubs I’ve run, that doesn’t find this incredibly exciting and inspirational.
You can even purchase the equivalent Sense HAT and get the designs to enable you to 3D print your own flight case, meaning you can have your own fully operational version in your home or school here on Earth.
Those pins you can see at the top of the Raspberry Pi image above are for GPIO - general purpose input/output. Enabling you to extend your RPi into the realm of electronics, by wiring in sensors, LEDs, matrix displays, servos and motors and many more component, which can then be interacted with programmatically.
The GPIO pins can also be used to add pre-built boards, such as the Sense HAT for the Astro Pi. One of my favourites is by Energenie which, coupled with some radio-frequency controlled electric mains plug sockets, means you can start to control devices around the home programmatically.
As you can imagine, once you start joining up all of the different pieces that we’ve discussed so far, coupled with other technological resources available, the potential is only really limited to one's imagination - and as we’ve discussed, children’s imagination is pretty phenomenal.
In one of my favourite home projects from earlier in the year, we used the Python API to create a ‘magic block’ in minecraft, which when you walk close enough to it, uses the energenie HAT, to trigger a disco light in the physical world. (Jack’s original intention was that it would trigger a loud klaxon in his sister’s room - but we agreed on a compromise :) )
This is again where I believe the knowledge of the art of the possible from those already in the industry is phenomenally valuable to help inspire and guide the imagination of the child
Our Own Private Web
The final project I’m going to mention is something I trialled with a group of 10 Year 5 pupils (9/10 years old) in a coding club last summer.
I took into school a box of 10 Raspberry Pi’s, router, switch, cat5 cables, and VGA adapters (fortunately the school had a batch of old monitors, keyboards and mice we could use) and we set about learning not just how to write basic HTML and CSS, but also ran local web servers, so that pupils had a more concrete grasp of what the web is.
I encouraged the pupils to setup the equipment (with mains power turned off at first) - which turned out to be utterly new to most of them, and turned out to be one of the most challenging parts of the project, taking around 45 minutes the first time.
With all of the RPi’s eventually plugged into the router/switch we discussed IP addresses and I’d setup more human-friendly names for each raspberry pi: rpi1.local, rpi2.local.
We then made a new file with a .html extension, put some very basic HTML into it, and showed them that they could view it in the browser. They made some basic edits, such as adding a personal message, saved and reloaded.
I’d already installed Apache (a freely available Web Server which is estimated to serve over 46% of all active websites ) on the RPi’s and setup some directory aliasing (and permissions) such that those files they had just created were effectively now served live - and we then navigated to each other’s machines to view their personal pages. (This generates a LOT of excitement)
Finally they learned about the anchor tag, and started HREF’ing links into each others machine… and hey presto we had the beginnings of our ‘Own Private Web’.
I’d setup another RPi with a whole load of example files for them to explore, copy, and learn from, including using parts of Zen Garden to introduce CSS.
Final steps were to show them how to ‘view source’, and and they were off. Very much self-guided and learning independently, as well as helping each other - my role was then pretty much fielding occasional questions, which predominantly involved typo’s (scr instead of src), and why there wasn’t an H0, to also some really interesting areas like how hex colour codes worked.
One delightful aspect that the pupils undertook by their own volition was to share what they learned - a common theme in the web pages that they subsequently wrote, was instructional pages, sharing with the group a new aspect of HTML and CSS as they uncovered them.
I also run a headless RPi (v2) which is externally accessible, and mapped to a proper domain name. Which means we can discuss it end-to-end: Physical Server, OS, Apache Web Server, simple HTML/ CSS files, Domain names (DNS), the network, and finally the browsers on RPi's in front of them.
As all-pervasive as the web is in daily life, as is depended upon by so many people on a daily basis, I wonder how many adults have a notion of how it works - but from my experience, if it’s presented in the right way, this is potentially accessible to a reasonable % of older primary school pupils.
(** If you do end up working with children in this area, you should definitely read up on children and internet safety - The schools I volunteer at already have their own policies and guides. Part of the reason for initially considering the local router/network approach was to enable me to have an environment which was completely disconnected from the web at large)
Where do I start as a parent/relative/neighbour/volunteer?
How early can children start?
In the photo below Zoe would have been 4 years old, and while I had to do a lot of the setup in advance of her using it, she loved exploring the Makey Makey to interact with the Scratch based piano.
There are some barriers to learning which are perhaps more acute for younger children, but some the items below could be factors affecting learning at any age:
Fine motor skills
Vocabulary / Language / (Reading skills)
Attention / Fatigue
Awareness of what is possible
Fine Motor Skills
Some people, especially younger children may find it challenging to use keyboards with keys that are too large or small for their hands.
I regularly encounter children struggling with double clicking a mouse - which can sometimes be greatly improved by changing the configuration settings on the machine they are using.
Using a trackpad, can be an unusual experience at first, in part at first due to the disconnect between this non-responsive rectangle rectangle near their body, and the relative movement of the pointer up on the screen
The touch interfaces on Tablets and Phones are wonderfully intuitive - I recall my daughter as a very young baby interacting with photos on our tablet in a completely instinctive manner. (which eventually leads to lots of grubby finger prints on your TV and laptop screen)
There are some fantastic learning resources for tablets such as Scratch Junior which can really make things accessible for younger audiences.
There are also some wonderful projects which enable logical/algorithmic thinking through interacting with tactile wooden blocks, such as Cubetto which is aimed at 4 year olds.
Vocabulary / Language / (Reading skills)
Even in a professional context, how recently were you in a meeting or presentation where someone use an acronym or abbreviation which left some of attendees either utterly baffled, or even a little uncertain that they understood what was being discussed. Abbreviations and acronyms are brilliant tools for discussing complex concepts in a short-hand way - but only if you can be sure that your target audience understands them.
For children, finding the appropriate language is even more crucial. A word like ‘icon’ might be completely alien to younger children (whereas ‘emoji’ might be more familiar).
You might need to put words on the whiteboard, while introducing a topic, to help them slowly build up their mental dictionary of these new terms.
Context and experience can also change the appropriate meaning of a spoken word (professionally think of: SAS vs. SaaS vs. Sass vs. sass), and of course the context for a 9 year old might be very different to you own.
(Hopefully, you have been able to establish an atmosphere such that the children are comfortable letting you know that they don’t understand.)
Even upper/lower case letters can be confusing, and I’ve had experiences where using an ‘uppercase keyboard’ confuses younger children. There are special early learning keyboards available which can help.
From a British standpoint, children will consider ‘color’ to be spelt incorrectly in HTML/CSS, or shortening ‘source’ to ‘src’ for an img tag and can frequently lead to introducing errors into their code.
Attention / Fatigue
There are various studies about optimal focus time for adult professionals, and many adult developers I know can focus for several hours at a time if they can achieve ‘flow state’. However for children younger, or those less practiced in longer periods of concentration, you need to be on lookout for concentration-fatigue… where giving them a short break mid-task, can reinvigorate them. In primary coding clubs I normally stop the session after around 25-30 minutes and do a ‘cool projects’ segment. This typically involves talking about, or watching short videos, ideally technology or coding related, but also often giving a narrative around the outcomes being through imagination coupled with artistic and technical skills. Some examples that have worked really well:
Wintergatan - Marble Machine
Action Movie Kid
Pixel Pyros by Seb Lee-Delisle
Mechanical Fuzzy Weather Machine () by Brendan Dawes
CUBESTORMER 3 : Rubik's cube solving lego robot
In my experience it gives everyone a mental-breather, while stoking their enthusiasm and focus for another 30 minute stint. You can gauge the room to determine if shorter or longer periods will work better for your group.
Awareness of what is possible
One question I often get asked by parents is : “What can we do with a Raspberry Pi?"
At first my response was “almost anything you could do with a computer", which after repeatedly eliciting blank stares, made me appreciate that this is one of the key areas that I think we in the Web/Software/IT industry can greatly help, namely: extolling the art of the possible, in a way which is exciting, while forming some stepping stones to help them develop in the direction of their interests. I think there also a need for greater support for parents, especially those who may have had little or no prior computing experience, and who would like to be better prepared to encourage and support their children in starting coding. In relation to this I have started an initiative called Code.Parents(), where further details and guidance can be found.
Finishing right back where we started: Confidence is a foundational facilitator for learning, at all ages.
Be cautious using language like ‘simple’ or ‘just’. If someone (of any age) is struggling with something - you suggesting it's 'easy', probably isn't going to help their self-esteem.
Be positive. Encourage the pupils to be positive and encouraging towards each other, and also with themselves. If needed, set expectations and boundaries that need to be met to be able to participate in the the club.
If someone is struggling with self-confidence, actively look for something, anything to praise them about. Maybe break the task into even smaller elements, or maybe change to a different activity altogether.
Go from where they are, to where you want them to be. Use praise and encouragement to engender appreciation and confidence. Your experience, passion and enthusiasm are just the sparks needed to ignite the tinder of their imagination.
I’d love to hear about, and to learn from, your experiences. I’m also very happy to try to help if I can: @bseymour
Back to blog posts list