Ask HN: Teaching programming to a 10 year old, and I'm kind of lost

42 points by newsisan ↗ HN
Basically, I was wondering what would be the ideal introduction and flow to teach this - ideally it would start out easy and the more engaging the better! Obviously it makes no sense to try and force something if the kid isn't interested, so help me make it interesting and easy to understand!

I was thinking

-Scratch or Alice for the basic concepts

-Then either learnpythonthehardway, diveintohtml5, diveintopython3, ruby+shoes (hackety hack) (thanks to the respective maintainers/creators of these apps/sites)

Any comments (with or without experience) would be appreciated greatly, as I am unsure which of these would be most appropriate for a complete beginner, or whether there is something else that would be more suitable.

50 comments

[ 2.7 ms ] story [ 116 ms ] thread
A couple of random thoughts:

When we got our first computer, my then husband was excitedly explaining to me how to do stuff on it. I stopped him and said 'Where is the on switch??" My point: You may need to scale things back to where she is from your current vision.

Also, I recently showed my two sons a little html and css. My oldest has been wanting to learn a programming language and not finding anything intelligible for the way his mind works. A few minutes of demonstration and the light went on as to what kind of info he needed, which he promptly began looking up. We also used analogies using video games to provide some mental models for it. So if you run into any hitches, consider trying to adapt to her learning style and using something she is familiar with to provide examples.

Good luck. And I still want to learn a programming language, so would love to hear how this goes.

Hackety Hack still exists http://hackety-hack.com/

I've taught several people quite new to computers Ruby and HTML, I've found the hardest thing they try to grasp is logic, drill into their head how conditionals and boolean logic work - it's needed everywhere.

EDIT: I can't stress this enough, I've had people where I thought I've made a break through, they seem to grasp it, then two weeks down the line I look at some code they're trying to debug, and it's like they completely forgot how flow control and conditionals worked.

Thanks for mentioning it, and thanks to the OP for the thanks. ;)

Hackety is designed for people that are absolute beginners at the moment, and I plan on making more 'intermediate' and 'advanced' things later. We're still pre-1.0 for another few weeks, though, so there still might be a few small rough patches. Specifically, soon it'll just be one program, rather than downloading both Shoes and the hackety.shy.

Step 1, learn to elide almost everything except what you're actually teaching. This is surprisingly harder than it sounds and often involves saying things that are technically untrue.

Step 2, teach the things required to do tasks.

For a child, you should focus on things that they can understand the output of. Sound, animations, pictures. Turtle/logo is a fantastic platform in this regard.

For, well, everyone, you need to ensure that what you're teaching is what they're interested in. If they're not excited about moving a cursor around a canvas, then they won't learn anything.

You'll know you're teaching correctly when they start doing things on their own that you didn't expect.

Sean

Logo worked for me. If you want to teach a "real" language (Logo is practically a LISP! It's real!) then Python has a turtle module.
Another Logo fan here. I still haven't found any other environment that makes me wonder about the power of computers as Logo did. I was 7 to 10 years.
Cory Doctorow called Squeak "logo for the 21st century."

    http://squeak.org/
Definitely. Learned Logo when I was 7 years old and it gave me all the fundamentals I needed.
Umm well if you have the money go for lego mindstorms, if I was a kid again I'd want to play with legos and robots. (Hell they are still cool)
You need to be a kid to play with lego (or mindstormers)?
My 8 yr old has been doing lpthw with some success. I'm partial to that method since I learned by typing basic listings in from books when I was a kid.
What does the 10 year old want to program? Most likely a game, which is challenging but which fortunately may be satisfied by a working snake or Space Invaders rather than requiring stereoscopic 3d with a physics engine. But a simple interactive graphing calculator can be just as much fun as a game. Tools and diagnostics are good too - instead of teaching arbitrary-seeming practices for problems the kid has not encountered yet, let them run into the problem (eg having to check the dimensions of the window on loading) and write a tool to make the computer do the work.

As a kid, I found the logic relatively easy, and the control structures moderately easy. Abstraction and complex types were the difficult part for me, and I still tend to evolve them by trial and error rather than defining them in advance (though having done so, I usually enjoy refactoring as soon as I have a working prototype).

http://inventwithpython.com/ this isn't a bad book for teaching those simple games.
It's very good - I had an earlier unfinished version. Thanks for reminding me of it, it's expanded considerably since the last time I saw it.
I personally started by learning basic when I was about 9 or 10 years old...thing that got me interested was an open source game I used to play a lot. I accidentally stumbled onto the knowledge that changing the voodoo magic text at the beginning before launching the game (it was written in QBasic i think) managed to change things around in the game itself. If they like games, that could be a good way to start? It gives early rewards, as they're modifying something that already exists. From there I started getting ideas of things I wanted to make myself...and just experimenting here and there.
Put a LAMP stack together for him and have him create basic website stuff that he sees everyday.
I've done some Scratch stuff with my 10 year old (he was 8-9 at the time). It is a good starting place for teaching some of the concepts like looping, objects, and messaging. If nothing else, it is a good way to visualize those, even if you turn to something like Python for "real work".

I would start by asking him/her what she/he wants to do. Pick the tool that fits best. Want to build a game? Start with Scratch because it teaches the actor-based programming that you want to use for games.

Hard to give more advice without more specifics.

I'd avoid Dive Into Python and HTML5 -- both are intended as quick-start guides for those specific technologies, not as general programming tutorials. They won't make a lick of sense without significant prior programming experience.
I learnt HTML at 10. My grandad taught me that, then I went on and used w3-schools to continue learning. I think that's a very good starting place.
Do some web stuff with basic HTML/JavaScript/PHP or Flex. Having a command line program that adds two inputed numbers is great and all, but having two input boxes and a submit button followed by showing the answer to the side is much more entertaining. (If you go the JavaScript route I'd recommend something like ExtCore as a library instead of raw 'ajax' and so on.)
I taught 3 Bootstrap courses last year to middle-schoolers, with pretty good success. Bootstrap is an introduction to functional programming in Scheme. The students write simple callback functions to implement animation and collision detection in a 2D side-scroller video game framework.

I think it's a pretty good introduction to programming for kids of middle school age, though it assumes familiarity with elementary algebra and the Cartesian coordinate system. Others have taught it to students in the 5th grade, who had no prior algebra experience, though I can't personally vouch for how effective it is for those students.

I modified the standard Bootstrap curriculum quite a bit as I went along, removing the written workbook exercises completely (my students hated them), and replacing them with interactive programming exercises. I replaced some of the least-engaging programming exercises with some of my own creation. For example, I designed a lolcat image macro exercise for the "Introduction to images and strings" lesson. It was a huge hit: kids were making screenshots of their images and sending them to friends. I also added support for projectiles, background music, and user-defined sounds to the standard 2D game engine, in order to make the final games more compelling.

In the future, I think I'd rather use a problem- or project-based approach to teaching introductory programming, but Bootstrap is the best freely available, structured curriculum I've found so far. My main frustrations with it were the written workbooks, which I eventually dropped, as mentioned above; and the fact that I only had 10 90-minute sessions, meeting once per week, to teach it. That's barely enough class time to get through all the material, even if things go perfectly smoothly. It's definitely not enough time to give students the opportunity to explore and experiment on their own, nor especially to fail and then learn from those failures, which, in my experience, is the most effective way to grok programming. However, the compressed timeline was a limitation of the after-school program I was teaching in, not Bootstrap per se.

Find out more about Bootstrap here: http://www.bootstrapworld.org/ I'm happy to give you my modified Bootstrap framework (with projectiles, etc.) and the Keynote slides I used for my lectures. The slides have very few words; they're mostly animations, diagrams, and images intended to reinforce the oral lecture.

I also "taught" a couple of Scratch sessions to middle-schoolers. You don't really teach Scratch, though; in my case, it was more like giving a 10-minute demonstration of building a simple Scratch program, and then turning the students loose, and giving them a bit of assistance when they got stuck.

Student engagement with Scratch is typically much higher than with Bootstrap, in my opinion. My Scratch sessions were each about 2.5 hrs long, and almost all of the students kept experimenting from start until finish, with 3 or 4 even staying an extra hour afterward during their free period. However, personally, I think I'd move on pretty quickly from Scratch to something capable of procedural abstraction, if a student showed a continued interest in programming after a month or two of Scratching. Among other issues, there's simply no means for students to create their own blocks in Scratch, nor to encapsulate groups of blocks into larger blocks. However, I just heard from a friend that there's a new version of Scratch coming, code-named Sage, I think, that will provide at least some of this missing functionality.

Scratch certainly requires less effort on the instructor's part than Bootstrap. Scratch includes a ton of assets, for one thing. With Bootstrap, when your student(s) come up with a game idea, you might have to help them find images, and then do some Photoshop work to extract them from their backgrounds, scale them, etc.

Oh, one more thing I forgot to mention.

Another problem with Bootstrap is that the students seem to be quite confused about control flow. They don't understand how the whole process starts, proceeds, and then repeats itself. The confusion occurs because the students are only writing callbacks, and are never exposed to the event loop of the game engine.

Scratch does not have this problem. Scratch programmers are entirely responsible for deciding how events are sequenced (when they need to be, at least; without explicit sequencing, everything in Scratch executes in parallel by default, which is how the real world works and is therefore familiar).

I think understanding control and/or data flow is a crucial concept for introductory programming. It helps the student develop a complete mental model for how programs, when executed, create dynamic processes. For my Bootstrap classes, I came up with a pretty silly real-world scenario in an attempt to explain to them what Scheme and the game framework were doing behind the scenes, to give the students at least some sense of "who" or what was causing their functions to execute, but I'm not convinced they really understood it. There was a bit too much magic going on for my liking.

This reminds me of when I was 10 years old and got a copy of Think Pascal for the Macintosh. Previously I had done the usual AppleSoft BASIC, Logo, and even some Assembler and HyperTalk. But GUI programming stopped me short—partly due to the unattainable cost of InsideMacintosh—but mostly because the basic control flow was an inscrutable mystery to me, with nary a mention in any documentation I could find.
My son started on Scratch when he was 8 and I think as far as looping and conditions are concerned, it's top notch. Just having that understanding of how a computer works through a problem and dispatches messages and acts on those messages is priceless.
If the kid doesn't seem interested in learning a general purpose, turing-complete programming language (a lot of kids don't at that age), then don't try shoving it down as throat.

Instead, get him into languages that have a limited instruction set. this link:

http://marshallbrain.com/kids-programming.htm

came my way a while ago, and it has a few examples of things that you could use. Light-bot should be a lot of fun for most kids, and it could give kids a good foot hold into greater abstraction.

When I was 10 my dad taught me if else and how to make dialogue boxes in visual basic. My imagination did the rest.

So my advice is teach something that is practical and understood by the 10 year old. That's the best way to keep him/her interested. No point teaching stuff and telling him/her to have faith that one day it will be useful. That's not effective! You can let college do that later. But right now it's best to show the cool stuff to really get that interest going. So you don't necesarily have to start with the basics. Something cool, show him/her how to tweak it, voilà.

FWIW (no teaching experience here): In Russia, they're using Pascal to teach programming although I would try to explain programming in some basic abstract concepts.

Like: Program is a list of instructions for computer to do and variable is a "box" where some value is contained.

To make it more engaging you probably need to homebrew some nice and easy to understand demos. Random idea: write a simple graphical library for visualisation for your favourite language to use with your demos.

The two vital things you can help a kid with are:

1. Setting tasks that are within reach but will stretch his ability (and getting his buy-in on the idea before you start)

2. Teaching him how to find the answers to his own questions

I'd do all the setup yourself so the kid can jump straight in to producing something. I'd use FTP as it's easy to conceptualize. Avoid the command line and version control.

I'd start with HTML (written in Notepad) so that you can learn to present any data output. Just teach basic tags: h1, p, table, a href. Use w3schools for reference. Build something like a 'My Family' website with a page for each family member and links to the others.

Then maybe stir in a bit of CSS - again just basic stuff (colors, borders, positioning) and again using w3schools for reference. Use this to make the My Family website a bit prettier.

Then try some PHP/MySQL. You could save each family member in a table and use one PHP file to display each one based on an id specified as a get var.

Simple project ideas to try after that could be a simple CMS or (my favourite) a very basic Twitter clone.

C++ and then Java. It's what I did, those two will introduce him to OOP, and making GUI apps in Java is never going to get old, I guarantee.
I'm with dpcan on this one. I started my current 10yo on Scratch at 8 and have been giving him incremental "challenges". The immediate feedback for even his first "program" was enough to keep him hooked. He regularly keeps making new games and often pushing the system to its limits (Scratch has many annoying limitations if you're a seasoned programmer or even a kid who has figured out that something like an array - he wouldn't use that word, tho - would be useful).

He started 5th grade last week and one of his classes is a programming class which uses MicroWorlds - http://www.microworlds.com/ - as the learning platform. I grabbed the demo and may shell out the $100 for the home version, just so he can do stuff here in it as well. It's not a horrible system, but it's definitely rough around the edges.

I fully expect to have him starting in Python by 6th grade, tho.