A few months ago, Women at eBay UK organized a “Family Fun Day” where employees brought their children to work. Kids had the chance to shadow their parents and see what mom and dad do every day at this place they call “work”. Activities included face painting, virtual meeting room experiences, arts and crafts, barbecue, and, of course, ice cream.
Seeing that this was an opportunity for eBay engineers to demonstrate that programming can, in fact, be fun, we organized a couple of workshops to teach eager kids to code.
We divided the classes by age groups to ensure that all participants had approximately the same level of expertise. The first workshop was held for five to ten-year-olds, and the other, for kids up to age fifteen. With five eBay engineers volunteering, we were able to offer 2:1 support to the ten pupils participating in each session.
Programming in Blocks with Scratch
As many of the children were young in age, we chose to use Scratch. Scratch is a block-based visual programming language that makes it easy to design code blocks and visualize their execution. In this respect, learning a programming language was not the main emphasis of the workshop. Instead, we focused on teaching them basic programming concepts, and Scratch was an ideal tool to do so.
The project we selected was Ghostbusters from Raspberrypi.org. The ghost-catching game introduced the children to concepts of randomness, loops, variables and the incremental algorithm. It was the right combination of learning and fun without great difficulty to accomplish.
To begin, we selected the background and our ghost sprite. We were then ready to start modeling our code blocks.
The coding specifications for the ghost were simple. We wanted to:
- make the ghost appear and disappear
- repeat the same behavior for the same action
- continue changing the position it appears on the page
- keep score
First, we added the “hide” and “show” actions inside an infinite loop controller. This should have trigger the ghost to appear and disappear on the page continuously, but it didn’t.
Although the code made sense to us, we realized that the computer was executing this instruction so rapidly that the human eye wasn't able to register the effect.
To fix it, we added 1-second pauses after the ghost appeared or disappeared.
As predicted, the effect was now visible. While we were able to get the ghost to appear repeatedly in the center of the screen, we wanted to make it more challenging.
To ensure that the ghost appeared in a different position each time, we used a “motion” code block and set its location to random.
Some of the older kids decided to do it in a more advanced way by specifying the area on the x and y-axis.At this point, we were able to see the ghost appear and disappear, but could not catch or interact with it.
Click Event Interaction
Catching the ghost wasn't complicated. We produced a simple code block that made our ghost disappear when caught. With this change, we were able to click on ghosts to catch them.
All the kids were extremely happy to make it this far and immediately started playing their game. During testing, the children quickly realized that there was no scoring board to keep track of points earned.
Up to the challenge, the kids took it upon themselves to create this new feature and introduce it in the game.
Variables & Incremental Algorithm
The final step was to create a variable to save our points. Then, based on the action (yellow block), we had to change our variable in the following two ways.
The first one was to reset the score to zero at the beginning of each game.
The second, to increase the score after catching a ghost.
Code Complete & Play Time
Our programming phase was complete! At this point, we were ready to test and play the game.
Our Coding 4 Kids workshop has not only created significant awareness in the field of computer programming, but has also prompted continued interest in the children who participated, including many young girls. Several children asked their parents if they could continue working on Scratch at home!
Prior to the workshops we hosted, very few of the children envisioned themselves being the programmers and creators of a video game at such a young age. And although we know coding is a fundamental skill for children to learn, there is more to the process than simply providing them the computer code to run with.
Programming gives children the opportunity to enhance their problem-solving skills, develop an understanding and appreciation of how things work, and learn how to think differently. These skills not only enrich creativity and logical thinking, but also help to develop resiliency to failure.
For us eBay engineers, seeing the excitement and hunger for learning in the kids' eyes was both motivating and inspiring. Perhaps in ten to fifteen years, we will have some new eBay engineers to show for it.
Below are a few other online resources and websites that kids can use to learn programming.
Scratch is a block-based visual programming language and online community targeted primarily at children ages 8 to 16. Scratch was designed by MIT students.
Code.org is a nonprofit organization dedicated in expanding access to computer science in schools and increasing participation by women and underrepresented minorities. Code.org provides the leading curriculum for K-12 computer science in the largest school districts in the United States
Other than a brilliant source of online materials, CodeClub aims to provide opportunities for children aged 9 to 13 to develop coding skills through free after-school clubs (UK only at the moment).