How to Teach 11 Year Olds Who Can’t Sit Still to Code

First off, I wasn’t sure if it was even possible to teach children this young how to code, especially given the seemingly infinite number of distractions that are available to children these days. Nonetheless, I put my faith in my students and a new interactive teaching tool, Swift Playgrounds, to keep their attention. In the process, I learned what patience is. In the end, they learned conditionals, loops, functions, and basic algorithms.

Example of a Swift Playgrounds level

Swift Playgrounds is a top down view of a character who moves where you instruct him to using Swift code. It looks like a video game — and really it is a video game except your controller is an interactive text editor with lines of code instead of a joystick. The program runs on an iPad, so the kids were immediately eager to get their hands on it.

The goal in each lesson, or game level, is to collect gems and toggle switches. The levels get more complex as you progress, requiring you to utilize your knowledge of new programming concepts. This is great because the users have a visual representation of their codes functionality as it executes.



“He looks like Beats by Dre.” The kids were quick to point out how one of the three playable characters looks like the lowercase “b” for the logo “Beats by Dre,” his name in the game is Byte.

This seems silly, but the cute aspects of the animated characters, complete with sound effects, managed to hold my students’ attention more than I ever could at a whiteboard.

At the beginning of each class, I test my students’ knowledge by arranging the classroom to model an environment similar to the levels covered the previous day. I then have a student volunteer to play Byte, and collect iPads as gems, only moving around the level — classroom — as the rest of the class “programmed” him to. After Byte collects all the iPads, the students begin programming on their own.

Next, I explain the objective of the level and give them time to code a solution on their own. About a third of the class will be able to solve the question without further help. Sometimes, the students have trouble because the application’s built-in code editor makes it hard to modify code. I spend more time than I want just helping the kids ‘fight’ with the editor.

For the students struggling to build correct algorithms, my colleagues and I have them explain the logic for their program. We provide hints where their logic is flawed until they are able to solve it. It’s always great to see the “aha moment” when the kids have a logically correct solution and it is validated by Byte’s victory dance on the screen.

Overall, this application is definitely a win over trying to teach students how to code on a whiteboard or asking them to read a book. Although it is a huge step forward, there are some issues with teaching a class with iPads. Here are the pros and cons:


  • Swift Playgrounds is a free application with a teacher’s guide in the iBooks store.
  • You do not need to know Swift to teach with Swift Playgrounds.
  • The application helps children visualize multidimensional algorithms in an intuitive and playful way.
  • The lessons cleverly encourage students to incorporate concepts like functions by having them fill out skeleton code.
  • Playgrounds allows you to make your own levels from scratch.


  • iPads are expensive. For this course, they were generously donated by Trulia employees but not all schools may have access to these resources.
  • It is hard to keep sixth graders from opening other applications on the iPad. Apparently, there is a way to force only Swift Playgrounds to run but I didn’t get around to setting it up.
  • The user interface is frustrating. The first few lessons rely on an autocomplete for each line you type.