How to Teach your Kids to Code

Imagine if your kids built games instead of playing them? It’s probably easier than you think once you have a framework in place and some guidelines on how to start programming.

Try this: Teach Your Kids to Code: A Parent-Friendly Guide to Python Programming

For the last three years, I’ve been teaching kids how to program. Mostly Python, Java, Scratch, and App Inventor. I’ve also helped them get started on web design using HTML, CSS and some tools such as Bootstrap. More on the tools later.

When we first started teaching kids to program, we divided them by age group or experience. The way you do in school.

Actually, this was our first mistake.

What seems to work best is if you throw them all in at the deep end, so to speak, and leave them to their own devices.

This goes against the grain with most training methods which prefer to stream the kids. So, for now, I try to avoid this. Instead, we let the 8 year olds sit next the 14 year olds if they want. They might not talk much first, but then later they begin to help each other out.

Another advantage of this approach is that the kids can benchmark their efforts against others. Seeing what other kids are capable of often drives the most determined on, while others see what they’re capable of and step up.

How to get started

Most parents make the mistake of trying to get their kids to learn to program from day 1. This is the classic ‘run before you can walk’ mistake. This doesn’t work. It’s like saying, let’s learn how to cook. No way, right?

Instead, if you flip it around and say, hey, gimme a hand make the pizza, they might jump in. And making dough is fun.

So, it’s really how you position it.

Let’s make an app that you can plug into Minecraft (which could be cool) is very different than saying lets learn some Object Oriented concepts. What’s an Object? What’s Oriented?

Instead, work backwards.

If they like Minecraft, teach them to build a mod they can plug into Minecraft and show their friends.

Or make an app, upload it to iTunes and Google Store and tell their mates to download it. If you approach it like this, they forget their learning to code, and focus on the goal – peer recognition, kudos, and a boost to their ego.

See the difference?

What programming language should you teach kids?

The dilemma for most parents is where to start. There are so many languages, it’s hard to know which one is best. From one angle, it makes no difference as long as they start.

However, there are a few things to consider. For example:

  • What did you son or daughter want to develop? If it’s an app, then look at Scratch or App Inventor.
  • Do they want to create a website? Then look at HTML, CSS, and Javascript.

Which language will help them get a job in the future?

It’s hard to answer this as it’s such a broad question but Object Oriented languages are very popular. The most well known in Java. Note that while JAVA in theory works on both PC and Mac, its ‘development kit’ seems a little more tricky to setup on the Apple machines. However, Apple has its own OO language and you can – and probably should – use these if your children have Macs.

Other factors to consider:

  • Code Samples. See if there are enough free code samples out there for your kid to use to experiment with. Most of the major languages has tons of free samples but… getting these to work on your PC may not always be smooth, for example, there are different versions of Java and what works on one doesn’t work in later versions.
  • Videos. Sites where they can SEE how the code works are great. This works very well for Scratch and other visual tools which have drop and drop functionality. This is also a nice way to ease into program without getting in the code at too deep a level. In other words, starting a 11 yo with Java is probably a step too far. Something like Python might be easier for them to begin with. If younger, try Scratch.
  • One recommendation is Python. This is an excellent language to learn the basics of coding. It is easy to setup, comes with many free samples, and has some great tutorials. It is also one of the fastest growing languages. Google use it a lot, apparently. Another nice thing about Python is that you can install a games plugin that allows you – or your kid – to build games. Python also has the advantage that it teaches you the fundamentals of coding which you can then use when you advance to more complex languages, such as Java.

Motivating kids to program

Like all things in life our motivation fluctuates. One day, we’re super enthusiastic, the next something else seems more interesting. So expect the same when coaching your children.

The mistake many parents make is to ‘buddy up’ with their child. While this seems fine at first, later is becomes an issue as unless you’re there, they tend not to get started. A better approach is to join a coding club, such as CoderDojo or the CodeBots, and allow you kids to mix with others their own age. That way they can judge their progress against others, not against you. And it’s also a fun way to hang out and make new friends.

Another point is to allow for fallow periods. They mightn’t always feel like coding, so don’t turn into a nag. Instead, look for ways to re-ignite their interest and be flexible enough to allow them to choose a schedule and working style that suits them, not you.

Mistakes to avoid when teaching kids

Ok, this part is important!

Here’s another mistake parents make when teaching kids to code.

They start with the grammar. Everyone hates grammar. No progress is made.

What I mean, for example, is they try to explain what a variable is.

A variable is a…. and then they give a definition.

This doesn’t work.

Instead, show them how to create a variable, say using Scratch, and then walk them through different scenarios where variables are used.

Then they get it.

Learn to listen to them

Instead of trying to suggest what they should be doing, listen to what they’d like to develop. Remember, this is a creative activity for them. They don’t see how this will influence their long-term goals, such as going to university or having a career, in ways that you might.

This can be hard for hands on ‘goal-oriented’ parents. But you have to learn to step back and let them come up with the ideas. Remember, they do have ideas but if you insist or pressurize them into following your ideas, you’ve started on the wrong track.

So, sit back and listen.

Ask them to show you sites, apps, and games they enjoy. This is a pivotal moment. Remember to respect their choices and ask open, non-critical questions.

For example:

  • What’s most interesting about this?
  • How can we make this more interesting?
  • How can we start working on this?

The last question is interesting. If you help the kids to diagram what they plan to code, it becomes easier for them to see where they should start, and all of the steps involved.

Don’t get bogged down on using software or expensive tools to do this. A pen and paper is enough. Drawing it out really seems to help as they can SEE what they’re developing. It also helps them to sequence activities if you help them create a little process flow diagram. Again, don’t get hung up on the software, just teach them how to sketch our the steps.

Another suggestion is to bookmark the sites they get the most ideas from and/or make a spreadsheet in Google Docs to track these. Again, this might like common sense to you but that’s because you have years of experience to draw from. The kids don’t. So, think ahead and see yourself more as a facilitator than a teacher.

Give them the platform, tools, and tutorials to get started, then stand back.

Give them ideas

You can nourish their creativity by bring them to science museums, exhibitions, and other events that have some science in it. Again, don’t expect too much. Bring them along and let them graze.

You might be surprised that in six months’ time when they mention something you brought them to.

“Remember that thing we saw… well, I’ve built this app and…”

Learn to Interpret the ideas

Be patient.

Kids don’t have the language skills you have. In other words, if you ask them to explain why something doesn’t work, try not talk down to them or introduce terms that they’ll have no way of understanding.

Something I’ve learnt teaching kids to program is that you need to coach them more than teach them. What this means is that you provide the platform for them, give them the time, tools, and support they need to make it happen but then step OUT of the way when they get going.

Secondly, put yourself in the shoes of a twelve year old. They don’t have the same time management or organization skills you have.

So, you need to show them how to be organized without making them feeling dumb.

They have to feel you’re on their side and want them to do well.

Before I forget: DON’T compare what they’ve done with other kids efforts. This really crushes their spirit. Instead, encourage them for making efforts.

Areas where they struggle

One good example is setting up projects.

More than anything else, the biggest frustration most kids have after getting Python or Java installed, for example, is FINDING THEIR FILES. In other words, they write a piece of code, compile it, and go home happy. But when they get home, they can’t find the file.

To you this might seem like a no-brainer, but to kids (and some adults) finding their way around Windows 8 or an Apple Mac can be very difficult. Something else to consider is that a lot of gets use their parents laptops, especially when they come to classes. So, while they may know their way around their desktop at home, their Dad’s Macbook may be more difficult for them.

One way to address this is to:

  • Show them how to install the product, for example, Python.
  • Ask them to create a project folder on the Desktop.
  • Get them to create a very simple program and save that to the Desktop folder.
  • Get them to close Python or Scratch, reopen it and find the files they were working on.
  • Do this a few times and they’ll get the hang of where things are setup.
  • Another suggestion is to remind them to save the files with meaningful names. Quite often they don’t save at all.
  • Show them how to name the files and where to store them.

Explain the idea of making versions, eg pacman-test, pacman-animated, pacman-final, so they can tell which file are the ‘final’ version.

Another suggestion is to get them to explain how it works to other kids. Of course, some kids will be too shy to do this, but if possible try to coax them out of themselves and give a mini presentation, even to one other kid.

Build from that. If you teach a class, every week get two or three kids to present their work and walk through the code. This helps in many ways. It shows others how the code was designed and also how to present. It’s also a bit of fun. Of course, try to avoid favourites and picking the same kids every week.

When to help, when to step back

You’ve probably seen the parent that does all the hard things for their kids, saving them from the hardship of life. Their heart is in the right place but you can over-do it.

When getting your kids started in code, help them with the following:

  • Drive them to the computer course but don’t whinge that you’re giving up your Saturdays for this. Avoid the guilt trip. Do it for the right reasons.
  • Sit them with their friends if possible.
  • Help them INSTALL the software. Even for adults this can be tricky, for example, setting up environmental variables for Python Games.
  • Show them how to setup a Project folder. The desktop is the best place.
  • If you want, create a profile on your laptop for them. Use a very simple password. This can be there only area and stop them deleting your files by accident.
  • Give them admin rights if they need to install something or, as above, a profile with sufficient rights to install software if needed.

Don’t!

Try to avoid the following:

  • Sit next to them all the time.
  • Jump in with suggestions on how to make it more interesting.
  • Compare it with other kids. This is a real no-no. It defeats their confidence and makes them resent the other kids.
  • Remind them that this is good for their education. It might be true but it will backfire. Focus on the positives.
  • Delete their files without asking. What might look like junk to you, could be very close to their heart.

Challenge them

This is a bit of a fine art. You don’t want to challenge them with something too difficult. But it has to be a challenge at the same time.

One approach is to help them:

  • Install the software by themselves
  • Come up with an idea by themselves
  • Add one new feature to make it better
  • Review what they’ve done.
  • Promote it, if possible.

For example, with Scratch, you can upload the game (ie the code) to a site where others can download it. You can get a little mileage out of this if you send out a tweet or spread the message on some of the online forums. The idea is to draw a little attention to what they’ve done.

Next week, we’ll look at some tools you can use, then how to develop a curriculum, so you have targets in mind.