Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: First programming lessons for youngsters?
14 points by einhverfr on Nov 12, 2011 | hide | past | favorite | 14 comments
Hi

I am trying to teach my 7 year old son simple programming. I am wondering what others may see as useful tips at this age range.

We've started with basic games like him giving me instructions for things and having to debug where I go wrong in repeating them back, and I am thinking of moving on to very simple Perl, followed by some (simple) C. What does everyone think?



Instead of Perl, Python would probably be a better alternative. Python is very readable, easy to learn, and helps ingrain good coding practices, plus there are tons of online lessons including Khan Academy, InventwithPython.com, with a more complete guide for tutorials here: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python is easier to understand for the new programmer as it makes everything explicit whereas Perl is implicit. That said, if you are more comfortable with Perl than you can stick with that. I personally would hesitate to teach more than some very simple C


I've started programming at the age of 9. I remember, my first language was PHP. I really didn't like it, just wanted a point to start from. Then, after my switch from windows to linux, I learned bash (well, it's not so programming language, but it was funny too).

While falling in love with bash and system administration, I found Python, and read it's great for system administration purposes as well. Oh guys, it's very cute language, I then also learned Django and began interesting in web development more and more, and got an aim to write clean and simple code.

After playing enough with Python and creating some app in it, I started being interested in Ruby. It was the most amazing thing I've ever seen. Rails, great community and developer gems ecosystem — everything is so cool. I love it most of all.

However recently I've tried node.js and it expressed me as well. I don't know node much, but I love it anyway and I hope I'll learn it well, too.


Squeak is pretty nice, although I would make sure to progress to another programming language pretty quickly.


I'd be really interested to hear what people think about things like Logo (or other languages for children) and flowcharts or diagrams or "Jackson Structured Programming" style paper preparation.


Logo worked fairly well as an early programming experience for my oldest son (who is also an HN participant, but busy with his studies of computer science at university and with his hacking projects on GitHub). It certainly did a fair amount to prepare him for the LISP course that is the essential first programming course for computer science majors at his university. He took that course during his second-to-last year of secondary schooling, through our state's dual enrollment program for high school students. He also had finished the EPGY C course by then.

http://epgy.stanford.edu/courses/cs/


Is he smart? Try "Learn Python the Hard Way". Let him struggle with it a bit, and let him learn to ask the right questions, and let him learn to use search engines to get the answers, and maybe help guide him a bit when he gets really stuck.

In my opinion this provides a very gentle introduction to coding and development environments and also a rapid start to getting something done.

Once he's run a few things in Python you can start to introduce more complex programming (rather than coding) concepts.


Hi! I work at a "Young Researchers Centre", a sort of after-school crafts-and-technology place for kids of roughly ages 8-12. They can work wood carpentry, clay pottery, fabric, metalworks (lots of cute jewelry made from resistors :) ), electronics/soldering, Lego Mindstorms and of course computers. I supervise at the last two.

We don't let them play webgames, YouTube, Facebook or Pokemon websites or things like that, except for the final 30 minutes which is free time (though I still won't let them on Facebook--that's a hairy situation I'll let the parents sort out responsibility over at home. I believe the webfilter blocks it too).

Anyway, what they can do: Creating animations with a stick-figure animation program called Pivot, build plain HTML+images websites (with jEdit free syntax highlighting editor that also works over FTP) and create games with the free trial of Gamemaker (GUI-based point-and-click programming, not bad at all). Oh and this afternoon I helped a little guy shoop fake Pokemon cards in GIMP :-)

We are looking at introducing a little bit more actual programming into the possibilities, though. I visited this very same centre at the age of ten, and I'd just fire up QBASIC and start coding funky graphics, and there were at least one or two other kids that did similar.

My personal experience is that level of ability varies a lot with age, they develop real quick in this age-range. I wouldn't try and teach an 8 year old to program, not even with GameMaker. For some reason kids that age do not yet seem to have developed this hyper-interested bite-your-teeth-in-it persistence (you probably know what I'm talking about if you started coding at a young age--it's amazing, even if the smartest ones are invariably also super annoying clever little know-it-alls, which I try my best to not let get in the way of teaching them :) ).

I did have success with helping an 8 year old kid write his own webpage in HTML. His writing skills were phenomenal for his age, very little spelling errors, just needed to learn proper capitalisation and use of the comma :-) Capitalisation is probably also a result of not yet fully developed motor skills at that age, you can tell that pressing shift with their other hand actually takes them effort. Anyway, he wrote a short introduction about himself and proceeded to write a number of (actually quite funny) jokes and puns. I hope he returns soon, so we can add some styling to the page, it's just plain black-on-white Times with H1, H2 and P tags now.

One important thing we try to focus on here, is to give the kids something to do they can actually finish or at least see some tangible results of within one afternoon. It's really demotivating to be real busy for a couple of hours and not have something bounce around your screen at the end of it, preferably as soon as possible.

Another important thing is, that it's not school. They're not graded and they don't have to do things perfectly, or even the right way. The kids at electronics are soldering wires onto thumbtacks pushed into a piece of soft wood (with a paper printed diagram pasted on it, they make flashing lightbulbs, simple radios etc). It's very easy and it works, but it's not a proper way to do electronics :) In a similar fashion, I'm not going to push them to write properly CSS-ed content-layout-separated semantic HTML. If it's easier and simpler to use an inline style, or even a TABLE based layout, I'll show them how to do it. It's more important to show them how to get their hands "dirty" and that they can make these computers do anything they want, I like to show them quick results and they can always learn to do things the proper way later on.

On that note, I realize that PHP is probably the best way to get them started in programming. Most kids can get the hang of HTML pretty quickly (what are the tags for, opening and closing tags, how do you make an image, a link, etc). PHP has the nice property that you can just write it inside the HTML and easily add a little bit of interactivity, with immediate results. Indeed no templating languages, and yes it will grow into a huge tangled mess as they add more and more complexity BUT if there's one young these young kids are very good at, it's keeping track of a tangled mess of their own creation.

A simple example, one kid wrote a multi-page HTML website, with a menu bar (just a line of link tags) on top to navigate. What sucks for him is that he has to duplicate the menu code in every HTML page, and if anything changes or he wants to add another menu-link, he has to edit them all. There's no way to solve this in HTML, except with a FRAMESET which is kinda complex (and very outdated). So next time I will show him how, with a single line of <?php include('menubar.html'); ?> he can make things a lot easier for himself. It's still not real programming, but yet another small step along the way, that delivers immediate results.

Finally, a completely different idea I had, is to show them how to make simple games with Python and PyGame. IMO, Python is one of the best languages to start out with (I suppose Ruby is also pretty great but I'm not too familiar with it), and PyGame is real easy to use as it has functions for images, sprites, timing and even collision detection. I would start them off with a basic skeleton that opens a window and an event loop and possibly some object moving around or something. I'm not really sure whether I'll pursue this idea, because currently the "ease-them-into-PHP" idea sounds better, and I only have so much time to prepare new things :)

So, I can only share my experiences, unfortunately not offer much concrete advice, as we're still trying to figure out the best way as well.

(BTW myself, I started with BASIC at the age of 9. Reasonable beginners language, but it was also the only choice available for me :) )


Man, your story makes me want to go to this "Young Researchers Centre" so badly. Congratulations to this awesome project! Talking about education and competitiveness projects like these are going to be the pillars for our future.


Scratch seems to be popular for teaching kids


Logo was a useful language on the Apple 2e.


Have you seen codeacademy or rubymonk?


Whatever you try, make sure it does something that he is actually interested in. I remember being introduced to instructions that "did calculations" I had no real use for. Quite abstract, and without much underlying explanation. (This was also a time when many machines did not "do graphics".)

"What's the point?!"

Make sure you provide a sufficient answer. Not in words, but in engagement: His, genuine and unforced, and yours, helping him.

Just the other day, the NYT had an article on MIT's Scratch. I'd suggest having a look at it, whether via that article as an introduction or all that search will turn up -- stuff describing kids' engagement with the platform, so that you can decide whether it will work for you.

P.S. Others are mentioning Logo, which I'd forgotten. And maybe 7 is more the age for Logo than Scratch (9 or 10?).


I think teaching a seven year old C is silly. Spending time talking to your son like an intelligent human being about things which matter is far more important.

A seven year old is not a small adult. I am confidant that you learned C despite being substantially older. If you are going to teach your child a language,Spanish is a better choice at that age.


Coding, learning a language, playing an instrument, and learning about what's going on in the world, aren't mutually exclusive. They're synergistic. Learning to code teaches the fundamentals of logic. I learned (Microsoft) BASIC when I was about 7, on a TRS-80 Model 100 hand-me-down. I'd recommend it as a fantastic learning tool for any kid if you can find one; it runs on AA batteries, it's got a big keyboard, small screen with large pixels, relatively indestructable by today's standards; no games, no internet, and no bells or whistles...no programs, actually, except for a text editor and an address book...you have to make your own. And you can do quite a lot with it once you get the hang of shading pixels. Plus 16k of storage!

Also, it used to come with a manual that detailed how to use BASIC. That's how I learned it.

I'm not sure how you can go from saying you should talk to a kid like an intelligent human being to saying that a kid is not a small adult. Either you treat them like adults or they act like children.

And anyone who says teaching your child how to code is "silly" is a fool. IMO 7-year-olds should watch the nightly news (from a source outside the US that covers world events) and have detailed conversations with parents and teachers about what the stories mean.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: