Ask HN: What programming languages to teach kids under 12 years old?
Links to resources would be greatly appreciated.
Links to resources would be greatly appreciated.
HTML/CSS mixed with a little bit of JS is roughly equivalent to learning BASIC these days - you can throw something on the screen quickly, and add bits of functionality from there. Since errors throw exceptions, they're pretty easy to understand, and with the newer HTML features there's tons of room to grow into different domains. Plus there's a zillion resources for JS coding out there.
A good alternative, if the kids in question are not old enough to care about the prestige factor of "real" languages yet(an issue as you get near the teen years), is Scratch: http://scratch.mit.edu/ It reduces syntax to drag-and-drop while retaining some key concepts that bridge the gap into more powerful languages(conditional branches, named variables, and list manipulation)
- Dynamic language, fairly concise, relatively natural syntax, lets you make simple things with no fuss.
- Powerful enough for anything.
- Extremely practical for making actual useful things.
- Huge amount of examples to look at; unless it's obfuscated, you can just click "view source."
- No assembly required -- user is already reading this post in a Javascript interpreter.
Sure html and css aren't languages, but couple them with javascript and a complete novice can make quite a few dynamic pages (read programs) in an afternoon.
I think one of the most important elements for introducing young children, or really anyone, to programming is providing the ability to build a complete interactive program almost immediately. This can definitely be accomplished with a few html tags and a few lines of js.
Alternatively, if you have access to a licenses for it I would recommend initially starting them out in Visual Basic Studio. It strikes me as a good balance between immediate buildableness and a easy environment to learn the basics of loops, strings, if/then, for/do, etc. Maybe a week or two in vbs and then switch them over to js.
While I have no qualms with languages like ruby or python, the call for them to be used as introductory languages seem misleading. While you can learn to build a stand alone program in them in a week or less, I get the feeling that a static box program is not going to be that exciting for most 10-12 year olds today (obviously this same problem exists for vbs)
My feeling is that to most children computers are two things, the internet and video games. Building your own video games immediately (outside of flash which isn't a terrible suggestion) is somewhat out of reach for most beginners. But building web pages, and pretty interesting ones at that, is very accessible for anyone once they get the syntax down. In truth you have to get relatively far into ruby or python before you can understand how to display a page you've build or get to very much interactivity.
I started learning Ruby with Hackety Hack when _why started the project years ago, then plunged into Rails when I wanted to take what I'd learned online.
At 10 or so I learned Pascal.
My programming finally took off around 12 when I learned C and Assembler.
I think it's important to point out that no programming language is "too hardcore" (well, maybe assembler) for a generic 12-year-old. They can learn anything.
With that, I would suggest a combination of HTML/CSS/Javascript for the quick results and Ruby for the fun and elegance. Then let them learn whatever they feel like. If they don't feel an impulse to go learn this stuff by themselves after learning 1 or 2 languages, they're probably not interested anyway.
I was pissed later that summer when I installed FreeBSD only to find out these things were free.
Most of learning to program is motivation and patience in my estimation.
http://www.trollope.org/scheme.html
Linked from Paul Graham's essay Beating the Averages:
http://www.paulgraham.com/avg.html
In a nutshell, the advantage to Scheme is that there is almost no syntax for kids to get hung up on, they can jump straight into learning computing and solving problems.
And depending on how far they go with it, they'll learn some of the more powerful programming techniques like recursion and continuations.
The book referenced in the article is The Schemer's Guide:
http://www.schemers.com/tsg.html
Two other good learning books for children are probably The Little Schemer and The Seasoned Schemer.
Racket is an easy, free, open source environment to get started in:
or install the package 'plt-scheme' from whatever Linux distro you're using.
I think the answer in your case will similarly depend on the interest of the kids. Is the question for a general school class or for a few kids with particular interests?
I have to mention that there are still some bugs, since we're pre 1.0. These should be fixed in the coming weeks, though, 1.0 should be out for Whyday!
The C64 had a BASIC that is easy to learn, immediate evaluation for trying things out and failing fast, and direct control of various graphics (text mode, bitmap mode, sprites). And you could do all kinds of
Someone suggested HTML+JS but I think that a simple raster display is much easier to grasp than CSS layout or vector graphics. Pling: a pixel goes bright. Plong: a pixel goes dark.
First you want to have something on the screen and then you want it moving. Coordinates conveniently introduce you to numbers and basic algebra. If you want to do crazy things, you can POKE the hardware directly.
I can't think of anything this simple in 2010.
- Python or Ruby: Their syntax is intuitive (don't mention significant whitespace though ;), they have lots of libraries to quickly deal with graphics, games or the web, they're well documented without idioms that would be encountered early on and could confuse a kid.
- BASIC. I started out with it on an Amstrad CPC when I was 6 or 7. Interpreted, interactive procedural languages just feel natural to kids that age. I also learned that GOTO isn't necessarily bad (really, it isn't), and I also understood why functions are better than GOTO at a glance (spaghetti code didn't look neat or cool).
- If he/she's playing a game with a scripting language involved (like WoW with Lua scripts), try going that way. Most such languages are pretty simple, user friendly, plus results are directly visible. Exciting!
- Lego Mindstorms. One word: awesome. No, two: perfect.
- C is a little advanced, but if (s)he's interested in the inner working of a PC or a high-level data structure, it's probably one of the best ways to get down to it. Not recommended for absolute starters.
Basically, avoid high levels of abstraction and abstract concepts. A kid under 12 will probably have a hard time contemplating functional languages (although learning recursion at that age is a must). Also, if you're considering shell languages, I'd recommend Windows Powershell over bash/tcsh/etc. at least for a starter.
If he/she is 9-10-11 I think a fun combination could be a Lego Mindstorm robot that is controlled in C. You don't have to learn them pointers from the start, just let him mess around with the basic stuff such as data types and functions.
I think you should focus on results; getting a robot to do stuff could spike his/her interest because its 'cool'! A command line window might look dull.
http://smallbasic.com/ http://msdn.microsoft.com/en-us/beginner/ff384126.aspx
Most of us probably started with BASIC interpreters, so easy and readable code is obviously not a prerequisite. What BASIC interpreters did tend to do well was allow you to write a few lines, then run it and have it do what you said.
To answer the question then - I think any non-compiled language would be fine. I think things like Python is probably the best, as you're not required to program in an OO style, or in a functional style - just write lines, and they'll work.
Once the kids are interested and know a bit about how programming, sure, then teach them proper style. The important part is getting them to realise how to formulate thoughts in a structured manner - once you've done that, forming them in a different structure doesn't seem too hard.
Remember, the most important ingredient to learning something is fun. If you got you kid started and it like what it is doing, it will choose the right programming language on it's own.
If the kid doesn't really care, you might be able to spark interest with some sort of novelty, but they would probably get more out of it if you waited until they were older.
I was about 8 when I asked my dad to teach me how to program. Since I was interested and motivated, all he had to do was show me how to get started, and give me his old college textbooks. If I had lacked motivation, I imagine some more prodding on his part would have been effective, but if I had lacked interest, I don't think I would have learned much at all.
Got a lot of great answers.
Specifically, I'm interested to know whether Javascript in the browser is good enough, or too difficult to use in practice.
I'd recommend pygame over web development. Making a video game is much more fulfilling at that age in my opinion. Ask any 12 year old "do you want to make a video game or a website?"
For an older kid (~16), web development with APIs such as Facebook can be interesting too, because (s)he'll want to brag about it to his/her friends.
I really like the Facebook app/games idea, since current video games set the bar way too high for any individual working alone. Making "Pong"-type of games will probably not impress anyone these days :)
Then on to python.
They use a sucky framing policy where they frame the smallbasic wiki whilst displaying their own ads. This makes me instantly distrust the domain holder - however the apparent writers are working with kids doing programming (and appear to have married since they started the site) as http://blogs.msdn.com/b/socaldevgal/archive/2010/06/17/teach... attests.
It has a GUI which children will expect, runs out of the box on Windows which most kids will have, and allows them to easily interact with the GUI.
The other really nice thing is that as they progress they can use the full .NET runtime library so there is a lot of room to grow with out having to switch languages.
The only real downside is having a kid grow up like this: http://www.dailymotion.com/video/xdwn4e_java-4ever-microsoft... [.NET vs. Java trailer] youtube took it down :(