How I Got My Kids Into Programming
How I Got My Kids Into Programming
Join the DZone community and get the full member experience.Join For Free
The CMS developers love. Open Source, API-first and Enterprise-grade. Try BloomReach CMS for free.
I’m the father of four wild and crazy kids, and the two older ones are at the age now (4th grade and 1st grade) that I’ve started trying to get them interested in programming.
At first I wasn’t having much luck. It was always me asking kid #1 whether he wanted to program, and the answer was pretty much always “no”. I started wondering whether he was really mine at all since no spawn-o-mine would answer in that way.
But I eventually changed my approach. Soon my kids were asking me if we could go program. The 4th grader was up on early on Saturday morning programming, programming when it was time for dinner, etc. One day, I was surprised to see one of his pushes show up on my GitHub wall, completely without my involvement. New approach was working.
Yesterday a friend asked me to share some tips, as she has a fourth-grader. Here are some ideas that have been working for me and my kids.
Relate programming to something your kids already care about. It’s the rare child who will find variable assignment, for loops, arrays, etc. inherently interesting, at least at first. But writing a Minecraft mod—now you’re talking. Games in general are a favorite here. But whatever you choose, present programming as a means to an end instead of as an end in itself.
[Note: I'm not saying that a Minecraft mod is an appropriate first project. I've never written one. But the idea that they could write a Minecraft mod was very exciting to my kids. I ended up writing a simple game engine and then having the kids help out with that. You can easily find existing games if you don't want to write your own.]
Start by tweaking rather than writing from scratch. This gives the reward of immediate feedback and offers a gentle and incremental introduction. Learning new concepts, syntax, problem-solving approaches (e.g., divide and conquer)—these are hard enough for adults, let alone a child who hasn’t even taken Algebra I yet.
Introduce simple foundational, not-directly-programming skills. There are lots of examples here and I want to share several.
- Show your kids how to use the basic functions of the IDE (editing, saving, etc.). Just using the tool they see you use (assuming you’re a programmer) can be exciting to them.
- Put their code up on GitHub (or whatever), and show them how to push and pull code from central. The kids learn foundational concepts like “repo-out-there” (networking), that they can share code with siblings on different computers, that they should coordinate if they want to work on the same thing (teamwork), writing commit messages, etc. And with GitHub in particular, the social aspects are fun.
- Content can be initially more engaging than code. So if you have a game, show the kids that they can modify the maps, character definitions and so on by modifying content files. In my kids’ game, there are a bunch of ASCII files that serve as 2D game maps. The game engine requires that each line have exactly the same length. Sometimes when there’s a mistake in the map, the game breaks. The kids learn a ton from working with these maps: the idea that symbols in the map represent tiles in the game, that the computer is really picky about things like whether the line has 119 or 120 characters, how to look at a stack trace for
ArrayIndexOutOfBoundsto know that there’s a mistake in the line length, etc. All foundational stuff.
- Configuration is another area that can be fun. Normally when the characters traverse the game map, they can’t walk through walls, over water, etc. They were having to build bridges between all the islands just to see what things looked like. I added a “god mode” flag that allows them to walk anywhere they wanted. Again, good foundational stuff here—the idea of configuration itself (kind of like game cheats), variable assignment and minor coding if your configuration is actually in the code.
Obviously not a complete list (happy to hear additional thoughts), but those have been helpful for my kids.
Published at DZone with permission of Willie Wheeler , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.