Hacker Newsnew | comments | ask | jobs | submitlogin
Ask HN: My nephew wants to learn programming. What should I recommend?
26 points by gruseom 184 days ago | comments
My 11-year old nephew has been asking me how to get started programming. I'm thinking of suggesting Python because of its structure and clarity, though Javascript is tempting because of its web advantage. (There's Lisp of course, but I'm trying not to unfairly privilege the home team!)

What do you guys think? What language should he start on and what resources can you recommend for it? I think the goal should be to get him to rewarding feedback as quickly as possible, then he can either become an addict like the rest of us or drop it and move on.

Let me see what else... he's very smart and probably would prefer the straight goods to anything kidsy. Oh yeah, and (needless to say?) he wants to make games.



7 points by javery 184 days ago | link

Ruby would be a good choice, I hear the Prag Prog Learn to Program book is great and uses Ruby.

I was at my daughters new school the other day and I talked to the Librarian who is also teaching technology and he talked about using Scratch (http://scratch.mit.edu/) which looks very cool and is somewhat game focused.

-----

2 points by jackowayed 184 days ago | link

Seconding Ruby. The tutorial that later got expanded into the Prag Prog book is available free online: http://pine.fm/LearnToProgram/

I'm told it's very good.

And then there's always Why's Poignant Guide to Ruby, which is fun to read and teaches surprisingly well.

-----

2 points by icey 184 days ago | link

Ruby also has Jemini for making games: http://jemini.kenai.com/

http://www.logustus.com/2009/10/gauntaga-jemini-game-in-1-ho...

-----

13 points by algorias 184 days ago | link

I'd say python with pygame hits the sweet spot of being simple and rewarding (for 2D stuff anyway), while still exposing enough of the underlying mechanics to be a good learning experience. You need to implement the main loop yourself, call collision detection functions, update and redraw sprites, etc.

Considering that, the interval between sitting down and having something that actually runs in front of you is still reasonably short.

-----

3 points by torial 184 days ago | link

To add to this, I'd recommend a particular free book for learning programming through game writing: http://inventwithpython.com/chapters/

-----

7 points by b-man 184 days ago | link

I would recommend several things,

Squeak by Example[1], or better yet etoys[2]

How to design worlds, as already mentioned here

Alice[3], with something like [4].

Good old scratch from the logo tradition would also be cool[5].

[1] http://squeakbyexample.org/

[2] http://www.squeakland.org/

[3] http://www.alice.org/

[4] http://www.aliceprogramming.net/

[5] http://scratch.mit.edu/

Check them all out and decide for yourself. All of them are very consistent and fun.

-----

3 points by Zak 184 days ago | link

I wish someone had handed me Smalltalk at that age instead of telling me that all real programming was done in C. I think one of the most important things is being able to see results quickly to give it a hands-on feel.

-----

1 point by davidalln 184 days ago | link

This advice is good or bad depending on the style of your nephew. If he is really exciting about programming, then he most likely has in his head this idea of hacking away at physical lines of code rather than Alice/Squeak/Scratch.

I'd suggest BlitzBasic in companion to the fantastic book Game Programming for Teens (http://www.amazon.com/gp/product/1598635182/ref=pd_lpo_k2_dp...). Blitz is cross platform, extremely easy to dive into, and has a great graphics library. Or, if you want to start him out pure, I'd suggest python/pygame.

-----

4 points by RyanMcGreal 184 days ago | link

My son wrote a program for school in grade 8 with Python and PyGame that modeled mutation and natural selection among populations of predators and prey. It was a great learning experience for him, and introduced him to: classes and methods; inheritance; functions; datatypes; modules and namespaces; cartesian geometry; for, if and try blocks; and so on. It was challenging but not impossible for him to understand the stuff. Now he wants to be a video game designer when he grows up.

-----

3 points by techiferous 184 days ago | link

In order to accelerate learning, I believe it is best to try to learn one concept at a time. That's why I like to introduce people to the LOGO programming language if it's their very first programming language. It introduces many basic concepts that we programmers take for granted, for example:

* the fact that a computer will take everything you do literally and can't read your mind

* commands

* sequential iteration of commands

* loops

* conditionals

It's also easy to get quick results which keeps an early learner from getting discouraged. Once the learner is bored with LOGO, then you take them to a more powerful language. Ruby is nice because--even though it can get complex--you can start off very simple.

I would recommend this book for learning Ruby as a first language: http://www.amazon.com/Learn-Program-Second-Facets-Ruby/dp/19...

-----

10 points by gnosis 184 days ago | link

Logo. It's the gold-standard of introductory programming languages. It has also been described as "lisp without the parenthesis", so it should have many of the lisp fans on here on board.

Finally, it's just fun. I have fond memories of moving that little turtle around with simple commands like "FORWARD 100" and "RIGHT 90", when I was introduced to programming at around the same age as your nephew. You really couldn't ask for a better first language.

-----

3 points by iamwil 184 days ago | link

I recently had a kid that wanted to program as well. He's about 12. Wanted to program games, but didn't get very far in a directX book.

I had a couple choices for him, due to some requirements: 1) Something easy to install or didn't have lots of things to install 2) Something with a all-in-one gaming library 3) Something with some sort of community around it. 4) It'd be nice if there was a book for it.

So with those there, there was: Ruby and HacketyHack. http://hacketyhack.heroku.com/ It also has a app framework called shoes that you can use to build both games and apps. However, since _why left, all this requires a lot of hand hold to set up.

Lua and Love. http://love2d.org/ Lua is an easy language to pick up as it's pretty minimal, and love's 2D engine is pretty fantastic. I've used it before and it's pretty easy to get started with, and plenty of examples, as well as a vibrant community.

Python and Pygame. http://www.pygame.org/news.html Pygame has all of the above, and for me, the final winner, since there was a book that walks the kid along from basic text games to the graphics part. http://inventwithpython.com/

-----

1 point by steveklabnik 184 days ago | link

Thanks for the Hackety Hack shoutout...

If I could find a copy of Windows XP, and someone who had a Mac, I'd have installers done. Unfortunately, it's been a little hard to find people, even for just what amounts to a recompile.

-----

1 point by iamwil 184 days ago | link

Yes yes. :) I've not gotten around to it yet. Soon!

-----

5 points by gcv 184 days ago | link

How about DrScheme? I can't imagine more direct, rewarding feedback than the built-in graphics libraries. It's totally usable for games. It comes with a solid development environment, with a good step-capable debugger.

-----

5 points by techiferous 184 days ago | link

I would not recommend Scheme as a first language. The syntax is too far from what we normally use, so it provides a barrier to learning.

Ruby:

  a = 7 * 8 + 10
Scheme:

  (let ((a (+ (10 (* 7 8)))))
Ruby:

  print "you are big" if height > 80
Scheme:

  (if (> height 80) (display "you are big"))

-----

3 points by jrockway 184 days ago | link

Lisp:

   (loop for i from 1 to 10 collect i)
Ruby:

   [1..10].collect { |x| x }
But anyway, it turns out that people are not born with an inherent ability to parse infix operators. Infix is just as arbitrary as prefix or postfix. Anyone, even a kid, will figure the syntax out either way.

(Infix leads to confusing bugs, like "why doesn't 'foo < bar < baz' work?" Prefix eliminates this ambiguity.)

-----

2 points by mbrubeck 184 days ago | link

And the "How to Design Worlds" curriculum (by the authors of the well-known intro CS text "How to Design Programs") teaches functional programming for first-time programmers by building simple games and animations:

http://world.cs.brown.edu/

-----

1 point by rms 184 days ago | link

I don't know about gruseom's nephew, but I suspect that even or especially for people just reaching the age where they can begin programming, there is something inherently more difficult about understanding lisp-like structure compared to more python or ruby like structure. Perhaps I am underestimating the minds of today's 11 year olds, but I don't think I would have gotten lisp at that age.

If anyone has actually tried to teach a 10 or 11 or 12 year old lisp, the whole board would be curious about your results. For now, I think it makes more sense for gruseom's nephew to use one of the languages with pedagogy better tested on young people: python or ruby.

Gruseom, the choice between python or ruby doesn't make that much difference, go with whichever one you are more comfortable with. One nice thing about ruby is Hackety Hack; a self-contained learning IDE. http://en.wikipedia.org/wiki/Hackety_Hack

-----

1 point by Zak 184 days ago | link

I honestly believe the structure of Lisp is easier to pick up than other languages. You always know where a construct begins and ends in a Lisp.

-----

1 point by rms 184 days ago | link

I don't think the existing evidence trends towards lisp being easier to understand for the aggregate first-time programmer.

-----

1 point by Zak 184 days ago | link

I haven't read any studies on the subject, but I think it's a lot easier to see the structure of a Lisp program than Python or Ruby.

-----

1 point by ique 184 days ago | link

How about an extention of DrScheme allowing some really awesome livecoding? Fluxus gives you the entire REPL as well as an editor and the program runs and displays the graphic with a press of F5, this is how I first got into Scheme.

http://www.pawfal.org/fluxus/

-----

3 points by mullr 184 days ago | link

Processing. It's simple, requires very little setup, and most importantly it's FUN. You can give other people the things you made, and it works very easily with cool stuff on your computer. (webcam, sound) You can do animations and make simple games really easily. Spend a few evenings playing with it and I think you'll agree.

-----

2 points by zaidf 184 days ago | link

HTML and Javascript worked for me.

Basic(4th grade) -> HTML(5th grade) -> Javascript hacking(using view source)(8th grade) -> Visual Basic(8th grade) -> ASP(9th grade) -> PHP(11th grade) -> Python(uni)

My personal learning route between ages 10 - 20.If I could change...

1. I wish I had hopped onto PHP earlier.

2. Also wish I didn't waste a huge chunk of time in middle school struggling with Java.

-----

4 points by sp332 184 days ago | link

Following hacker tradition, you should throw K&R at him and see if it sticks :)

-----

3 points by j_baker 184 days ago | link

You sound like my grandfather telling me how he learned to swim. :-)

-----

4 points by pingswept 184 days ago | link

diveintopython3.org + pygame

11 might be a little young (not for programming, but for what I've recommended above).

-----

1 point by derefr 184 days ago | link

I'm a game designer now, but I definitely wasn't back then; instead, I got my start playing with scripting in RPG Maker. Kids, I think, don't want to make new engines or mechanics; they mostly just want to create content to use with their favorite pre-existing mechanics.

It didn't really ground me much into the why or how of what the game engine was doing, though; today, I'd recommend playing with a genre-specific game framework written in LÖVE—not least because learning Lua will actually count toward your resume in the games industry, and because it's easy to distribute on multiple platforms with no fuss.

-----

2 points by metamemetics 184 days ago | link

definately python over javascript!

-interactive shell

-easy to debug

-lot of great simple graphics libraries too

-making 3d shapes is funner than div containers

For 3d shapes, http://vpython.org is a good simple library. He will be able to figure out how to get balls rolling around in no time.

For a media library with sound for making 2d games, definately go with SFML (simple fast multimedia library) over pygame: http://www.sfml-dev.org/

It's faster and also has versions for C, C++, .Net, D, and ruby, so if he wants to learn one of those languages later he can try to port his game.

-----

2 points by cema 184 days ago | link

I second Javascript. It is widely and immediately available (even gui comes for free), allows using and learning different styles of programming, can be used to immediately write useful little programs, and scales up to moderately sized projects.

Python is good too. Not always immediately available, but easy to install. Other than gui (which would need to be learned), shares many advantages of Javascript.

-----

1 point by alttab 184 days ago | link

Something with immediate results.

Mine were HTML, TI-83 Basic, and Visual Basic. All of these could get something visible and interactive relatively quickly.

These days, I would say things like Javascript/Ruby/Python, while more simple than C/C++/Java, still don't have a direct pipeline to results that matter (for a learner).

Pygame would be my choice if ¥ou had to go the scripting route.

-----

8 points by dan_sim 184 days ago | link

play guitar instead

-----

3 points by cowmoo 184 days ago | link

Good advice.

After you have learned the basic open chords, scales and the fretboard notes, and "Wonderwall" - and are bored with the strings. You could go always back to silicon and build

a) an Arduino interface to an software/hardware mixer such as Ableton Live for live mixing and improvisation

b) an machine-learning program that takes GuitarPro tabs of the entire catalog of your favorite band and permute MIDI compositions/new guitar tabs based on the band's style.

c) Program your own synth in Max/MSP.

d) Develop a real-time music note recognition software that tab/annotate the chord changes, drum tabs, make music sheets for live online music jamming.

Also try to play the sitar/banjo/mandolin, there's already lots of guitar players.

-----

1 point by rickmode 184 days ago | link

word! learning to program is far easier than learning to be smooth with the ladies...

-----

1 point by Sukotto 184 days ago | link

He might like Robocode http://robocode.sourceforge.net/

Teaches basic programming as a side-effect of trying to make your take kill the other tank.

I haven't tried it, but what I've seen of it looks pretty interesting.

-----

1 point by roryokane 184 days ago | link

You need to learn Java before you write for Robocode, which is a fairly big task on its own.

-----

1 point by imok20 184 days ago | link

Make him a language: let me elaborate. Use Python or Ruby and write a library of functions that he can call in particular ways that will make a "game." Let him learn how they work, and let him dive into the source code and figure it out and eventually make his own functions and classes and ... etc.

Discovery is the most rewarding part of learning to program, and having fast payoffs is always nice to keep a kid interested. Worked for me (I started with Logo around his age, but Python/Ruby is way better.)

-----

1 point by kungfooey 184 days ago | link

I suggest checking out this talk at Nashville's Barcamp '09.

http://www.ustream.tv/recorded/2370164

Christopher did a good job talking about his approach to teaching a group of kids how to game. Syntax isn't as important at first - if you get them hooked on something simple like processing (http://processing.org/), then they will learn syntax later. Most kids just want to see results as quickly as possible.

-----

1 point by kls 184 days ago | link

I cannot believe that someone has not mentioned a LEGO Mindstorm yet. My 3 year old is already learning formal Logic with this and as a side effect he is learning robotics. My 10 year old has already dropped the graphical language for a C style language for robotics.

-----

1 point by gcheong 184 days ago | link

This is an excellent series of blog posts about a father trying to teach his 6 year old son to program a simple game. Maybe you can draw some inspiration from it.

http://davidbau.com/archives/2005/07/27/a_programming_questi...

-----

2 points by samc 184 days ago | link

He's in love with the idea of writing a game. He might not actually like programming.

So, you need to start with something simple that will get him immediate results. Which really means HTML these days as everything else needs umpteen objects before you can see any results.

If he takes to it, you can then move to CSS and javascript. And if you get this far then the leap to actionscript or python or whatever isn't that big and you'll know that you have a good student,

-----

1 point by jk4930 184 days ago | link

Okay, I throw something different in:

http://en.wikipedia.org/wiki/BioBrick

http://2010.igem.org/Main_Page

We'll see what kind of games he'll produce. :)

-----

1 point by j_baker 184 days ago | link

The Little Schemer: http://www.ccs.neu.edu/home/matthias/BTLS/

That's all you need.

-----

1 point by psawaya 184 days ago | link

Kind of obscure, but you might want to check out NodeBox. It's a bit like Processing, but for python. http://nodebox.net/code/index.php/Home

-----

1 point by roundsquare 184 days ago | link

Not sure if this is available, but is there a class near him which has kids about the same age? Thats how I got started in programming. It was great because the teacher knew how to teach kids and having other people around as enthusiastic as myself created a great environment.

-----

3 points by Tristan-Leroux 184 days ago | link

I'd say Python too. It was the first language I ever tried and it was very rewarding in terms of what I could do at such an early level. But I was a couple of years older and very much into technology already. But I stand by Python.

-----

1 point by Dilpil 184 days ago | link

XNA studio is nice because it comes with a finished game that you can edit, and there's no pointer nonsense to get tripped up on.

-----

1 point by kochbeck 184 days ago | link

He's 11? By the time I was 11 I was pretty darn good in Z-80 Macro Assembler. If he wants to make games, it's much better to get comfortable learning the hard stuff first. At his age, learning to kick a sprite across the screen will seem pretty... childish.

I've been reading the new edition of Jeff Duntemann's "Assembly Language Step by Step." While I don't particularly like how he teaches hex (which is terribly necessary to understanding Assembly), the rest of it made me think that it was the book I wish I had when I was a kid.

-----

1 point by extofer 184 days ago | link

Definitely start with Python. I found this great book http://www.manning.com/sande/ that is a good start regardless of age. In any defense, read this article (Section: "The Pitfalls of Java as a First Programming Language") to determine why learn with a language like Python rather than Java. http://www.stsc.hill.af.mil/CrossTalk/2008/01/0801DewarSchon...

-----

1 point by rmason 183 days ago | link

There are two languages that would be a good first choice:

Ruby with the Ruby On Rails framework

CFML using the open source Railo with the CF on Wheels framework

Follow up second language would be javascript

-----

1 point by d0m 184 days ago | link

I'd personnaly show him a bit of python and start him with small games. Sorry, but I don't think scheme is the way to start for a kid.

-----

1 point by j_baker 184 days ago | link

Why not? Lisp's grammer is much simpler than just about anything else. And there's literally decades worth of material on it.

-----

1 point by cema 184 days ago | link

Lisp is clean and the grammar is simple, that is true. But many kids want to see results as soon as possible, and there are languages (or rather systems based on certain languages) where this can be achieved faster and easier. Perhaps a lisp (scheme, specifically) may be a good first choice for a mathematically inclined kid, or more likely a teenager. I think that most kids would struggle with lisp.

-----

1 point by qhoxie 184 days ago | link

Ruby and Shoes are a great pair to introduce people to code. Quick and elegant results.

-----

1 point by jlsonline2010 184 days ago | link

Teach him Java J2EE, Spring, Struts 2, Hibernate, PL/SQL, and cure him of this blight immediately. This is what I do daily and you don't want him to end up like me :-)

I kid, of course. Probably the best thing to start with would be something like Perl, Python, or perhaps even Lua. In fact, Lua might be something he could even use in the gaming industry later. Whatever you do, don't introduce the poor kid to C# and DirectX :)

edit - on second thought, follow the advice of others and teach him guitar

-----

-1 points by giardini 184 days ago | link

A hairshirt and a whip, possibly, or sackcloth and ashes. At least a good talking to.

Seriously, by the time he's in college programming will likely be near the bottom of the list of skills in demand. While programming has provided many a good job for several generations, another field such as biotech or nanotech would be better for the next generation.

-----




Lists | RSS | Search | Bookmarklet | Guidelines | FAQ | News News | Feature Requests | Y Combinator | Apply | Library

Analytics by Mixpanel