Practical advice for teaching kids how to program

6 tips for teaching kids to code

Posted 18 Jun 2015 by 

up
78 readers like this
Image by : 

opensource.com

Programming is a creative activity that any kid can engage in. Your child might not care about writing data processing algorithms, but they might enjoy creating games, programming music, designing websites, or just playing around with code.

I've written several books to teach beginners of all ages how to code, and I know from experience that you don't need to consider yourself a techie or "good at math" to learn. In fact, kids often can learn to program faster than adults precisely because they don't know how "difficult" coding is supposed to be.

If you don't know how to code but would like to learn in order to teach your child, check out my latest Python book for beginners, Automate the Boring Stuff with Python, which you can read for free online.

Whether you are a software developer or you have no programming background, here are six tips to help your child get started with programming:

1. Use Scratch for younger kids, Python for older kids.

MIT's Scratch is a free programming tool designed for kids that runs in any modern Web browser. Anyone can run it at https://scratch.mit.edu. Its visual style was influenced by the Logo program, a staple of programming classes for children of the '80s and '90s. But Scratch is much more than yet another Logo knockoff.

Kids between the ages of 8 and 13 will benefit from Scratch's simple graphical interface. Scratch's drag-and-drop code blocks snap together. Pieces of code that don't make computational sense won't fit together, making syntax errors literally impossible. Scratch is great for younger kids who haven't developed typing skills.

Of course, kids who try to make more sophisticated programs will eventually run into a wall with Scratch. For teens and pre-teens, a real-world programming language like Python is more suitable. Python is an excellent first programming language because it has a simple syntax (unlike languages such as Java or C#), produces readable code (unlike Perl or JavaScript), and has a large and friendly community of developers behind it. If your child has outgrown Scratch, Python is the best next step.

2. Show source code for actual programs. Don't just talk concepts at them.

Despite its intellectual reputation, programming is a hands-on skill that requires practice, more than just reading books. Python's interactive shell encourages experimentation to find out what instructions do.

If you are tutoring your kids directly, writing code goes a long way compared to just talking concepts at them. Even after learning about variables, loops, and functions, sitting in front of a blank editor and starting a new program is intimidating. Sit with them and describe the code they should write line by line.

Or, if you are using online resources to share with your child, look for the source code to small games. Programs with less than a couple hundred lines of code work best.

The Scratch website automatically shares the source for all projects on its website. Encourage your kid to make modifications to the code and see how they change the final program.

3. Games are fun programming projects.

Programming video games is a common starting point for many young coders. Angry Birds, Minecraft, Flappy Bird, Five Nights at Freddy's, and other games are prime sources of inspiration. I've written a free book, Invent Your Own Computer Games with Python, which demonstrates coding concepts with the complete source code for several simple game projects (Tic Tac Toe, Hangman, etc.).

Be warned that games your kids love might not make great programming projects when they're just starting out. Many games require teams of developers, artists, and designers to put together. Games that require a lot of level-design and artwork can overwhelm beginners. It's much more satisfying to complete a simple game, than to start and never finishing a massive project.

Refer to my list of 49 small games with simple play mechanics for practice ideas.

Even though games are fun, I generally recommend against dedicated "game creation" or "game maker" software. Like Scratch, these apps often try to present simplified programming environments. But unlike Scratch, they tend to water down the programming aspects. Programming with them tends to become more like configuring pre-existing software.

4. Keep your hands off the keyboard and mouse.

Sharing knowledge is exciting. Showing someone what you know about programming is great. But coding is a skill that is learned with hands-on practice, so let the kids drive. Avoid jumping in to type on the keyboard when working with kids, even temporarily. If they have to click on a menu or button, point to the screen with your finger instead of taking the mouse and clicking it yourself. Whenever there is code to be typed, have them type it. It may be faster if you did it yourself, but your pupil needs the practice more than you.

5. If teaching a class, give each kid their own computer.

If you are teaching a group, try to give each student their own computer. Like playing a musical instrument, programming is a skill that is learned with hands-on practice rather than watching someone else.

The Raspberry Pi is a cheap, bare-bones PC that that runs about US$ 70 for a starter kit. Although adding a new keyboard, mouse, and monitor raises the total price to be comparable with a cheap laptop. Avoid Chromebooks, iPads, and tablets because; getting Python to run on them is difficult.

If you need to set up a computer lab for an afterschool club on a budget, the Raspberry Pi would allow you to make use of spare keyboards and monitors. (See the Raspberry Pi Foundation site and Ben Nuttall's monthly Opensource.com Raspberry Pi column for free resources.) Otherwise, I recommend the cheap laptop approach, especially if you don't have a dedicated space and need to store the computers after class. Laptops have fewer cables to deal with and store easier.

If individual computers aren't possible, kids can pair up and take turns. Remember Tip #4: Teach them from the start to ask their partner for the keyboard and mouse instead of just grabbing them away.

Some kids may be boastful and eager to dominate the machine, and less-confident kids will gladly let them have it. Have one kid be A and the other B. At points during the lesson, explicitly tell the group to switch seats so that A (or B) is in front of the keyboard and mouse equally.

6. Skip the computer science.

If you are a software developer, you might be eager to share your technical arcana. Explaining recursive flood fill algorithms or practicing problems from Project Euler (a great practice problem site for those who want to sharpen their coding skills) is a lot of fun. Being dumped in the deep end is not so fun on the learner's end. Some topics you'll want to hold off on at the start:

  • Object-oriented programming
  • Recursion
  • Design patterns
  • Data structures besides lists/arrays and dictionaries/hash maps (linked-lists, binary trees, etc)
  • Networking protocols (beyond simple HTTP requests)
  • SQL databases, or other Domain-Specific Languages

A good rule of thumb: If it's the sort of question that would appear in an interview at Google, skipping it might be better. When starting, covering a wide range of topics is better than going deep into technical details. Let your kids find their own passion. Once your child samples what the programming world has to offer, they'll be excited to explore the parts they like.

8 Comments

stevenice

During the early 1980's Sinclair introduced the ZX81 and ZX Spectrum to the UK populous (Timex in think in the US). We used to spend hours typing BASIC code listings from magazines for games and utilities. I am sure this helped me get to grips with code as I could see and understand how the code was going to work. I wonder if anyone tried this with the kids of today rather than just downloading?

Vote up!
0
Vote down!
0
eMBee

even after using computers for more than 20 years i learn and retain more when i type all the code myself, even if i just copy from a tutorial. so yeah, i'll definitely try that with my kids. can't wait until my son is learning to read...

greetings, eMBee.

(this is a statement of opinion, and while CC-BY-SA allows you to make changes to it, if you actually do so, it is no longer my opinion, and therefore you may not associate my name with that, otherwise just consider the license to be CC-BY-SA-ND)

Vote up!
0
Vote down!
0
pshapiro

This is excellent advice, Al. Programming can be a very fun hobby for youth and for some youth, it can be the path to a rewarding career. I'd encourage folks to also see if there is a CoderDojo youth programming club in their town. If there isn't one, find a few folks to start one. You might also ask for help from your local public library, scout group, makerspace or other civic organization to help start a CoderDojo.

To locate a CoderDojo near you, search the web for the word "CoderDojo" and your town's name.

These clubs are run by volunteers, it's useful to know. I have found them to be very inclusive of all youth, regardless of programming experience. At some CoderDojo meetings youth learn skills related to programming, such as tinkering with the insides of computers, making screencasts, building web sites, soldering, etc.

Programming can also boost youth sense of wondering which is excellent, because wisdom starts with wonder. (Socrates).

Vote up!
0
Vote down!
0
Don Watkins

Great article. I agree. Young students just love Scratch. In January and February of this year I was working with a group of elementary age children in the local public library and they loved using Scratch and before and after each class session I gave them opportunities to share what they had learned or programmed. They loved it. I've never taught Python and I'm still learning to use it myself. I like your suggestions. I love teaching students and adults how easy it is to build websites and customize HTML and CSS.

Vote up!
0
Vote down!
0
robinmuilwijk

I can only agree with my fellow moderators, that this is great advice for both parents/mentors, and kids. In fact, I signed up for a CoderDojo next week, see how my son likes all this technology and coding. He has already tried Scratch a few times at home, and enjoyed it.

Vote up!
0
Vote down!
0
Chrisjr

Or have them watch this kid programmer code live http://money.cnn.com/2015/05/05/technology/11-year-old-coder-live-stream/

Vote up!
0
Vote down!
0
r3bl

I would also suggest HackerRank (https://www.hackerrank.com/) as a great alternative to Project Euler.

The "quests" are divided into different categories judging by the subject of the "quest". You can use a lot of programming languages and type directly in their web interface using your favorite programming language. Every "quest" contains hints (in forms of linking to other resources) on how to accomplish it.

Vote up!
0
Vote down!
0
Tamasin Ford

Great article! We use the Scratch / Python sequence at Power Up Tech Academy (http://powerupta.com) for the same reasons you mention, and I'm a huge fan of both for using with kids. I also completely agree with your assessment of game creation software. It's not going to really teach them coding.

One other tip I would add: Be sure to try the project out yourself first before trying it with a kid. Don't assume that just because you are a good programmer that you are going to understand how Scratch works, or the intricacies of Pygame. You need to be focused on teaching, not debugging, as much as possible during the session.

Vote up!
0
Vote down!
0