Ask Slashdot: Best Book For 11-Year-Old Who Wants To Teach Himself To Program? 525
Posted
by
timothy
from the it-isn't-huckleberry-finn dept.
from the it-isn't-huckleberry-finn dept.
New submitter waferthinmint asks "What is the best book for my son to use to teach himself to program? He wants to study on his own but everything seems to assume an instructor or a working theoretical knowledge. He's a bright kid but the right guide can make all the difference. Also, what language should he start with? When I was in HS, it was Basic or Pascal. Now, I guess, C? He has access to an Ubuntu box and an older MacBook Pro. Help me Slashdot; you're our only hope."
A plug for Alice (Score:5, Interesting)
I would like to put in a plug for Alice [wikipedia.org] as a great introductory language and IDE too. Unlike a lot of introductory languages, it teaches actual object-oriented programming, and it's fun to boot.
Hello World! Computer Programming for Kids and Oth (Score:4, Interesting)
My nine-year-old is using "Hello World! Computer Programming for Kids and Other Beginners" to learn Python. She's not really very motivated, though.
http://www.amazon.com/dp/1933988495 [amazon.com]
I am self taught (Score:3, Interesting)
I am a self taught programmer. For me it started with video games which I practically grew up on. My mom bought a nintendo to keep busy while staying at home with her new baby. I started playing before i could walk, and my interest was sparked when I basically said "Who set these rules, what if I want to jump higher or have more bullets". My parents got me a Vtech computer from walmart for ages 9 and up. I was 6. It had a single line text-only display with 20 characters. But it had BASIC on it and I learned it myself through reading the book.
Get him going on BASIC. It's not out of date.
C has way too much involved features that would confuse him. Scoping, inheritance, pointers, etc.
Get him to the point of writing a small text based battle system. That's what I first wrote as a kid.
"You encounter the enemy, who has 20hp"
"Press 1 to punch, 2 to kick, 3 for magic list"
1.
"You punch the enemy doing 7hp damage, he has 13hp left"
"The enemy kicks you dealing 12hp damage, you have 12hp left"
"Press 1 to punch, 2 to kick, 3 for magic list"
3
"Magic list"
"1: fireball"
"2: heal"
"3: whatever"
1
"You shoot a fireball doing 13hp damage."
"THE ENEMY IS DEAD, YOU WIN!"
Mobile (Score:5, Interesting)
I don't know about a book but I'd teach him Objective C or Java. Something you can use to create an app for a mobile device. There's nothing like being able to carry your work around with you in your pocket and showing it off to people. Personally I'd go for Objective C because making a UI in Xcode is quick and easy and you can then focus and the real coding.
Free Python Book (Score:3, Interesting)
Re:A plug for Alice (Score:5, Interesting)
I should also mention that there are a bunch of books [alice.org] available that will help with it too.
I would also urge you to ignore all the "If he can't start out with the hardest stuff, he doesn't belong in our fraternity" snobs here who are recommending you try to get your kid to learn stuff like C, and Python hand-coding right out of the gate. If you subject him to that, not only are you setting yourself up for child abuse charges, but you're probably going to turn him off to programming for good. He should learn the principles first (which Alice teaches in a fun way), and save the hard stuff for when (and if) he's ready to pursue it further..
If using Python... (Score:5, Interesting)
You might want to check out the book Snake Wrangling for Kids [briggs.net.nz]
Lego Mindstorm (Score:5, Interesting)
If he is 11, get him lego mindstorm. Out of the box it comes with a UI that lets you do logic and control your lego creations. Once he gets the concepts of loops and ifs, wipe the firmware with community Java firmware (lejos) where he can write Java code to control his mindstorm bots.
By this time he would have bootstraped himself into programming and internet would be enough.
Re:Head First (Score:5, Interesting)
Set him up with Scratch.
http://scratch.mit.edu/ [mit.edu]
I taught my daughter to program using it. It uses most if not all of the standard logical constructs, but instead of having to type and debug code, you drag and drop, attaching little lego-brick looking things together. It lets you focus on logic errors instead of syntax errors, and makes it a lot more accessible.
Also, you can log in to the scratch website and publish from within the Scratch IDE. This was a major source of encouragement for my kid, who is more driven by the appreciation of her peers than by the achievement itself. After our game got featured on the front of the website and over a hundred kids posted comments about how cool she was, it stopped being a way to spend time with Dad and became something exciting in its own right.
You can also download other kids programs, open them in the IDE and see exactly how they work. If you then create a derivative work and publish it, that will all be preserved... anyone looking at your program will be able to identify that you made it, what it was derived from, and who made the original. So, it teaches them to share, too, and helps them learn from each other.
Once he gets deeper into it, you can buy him some hardware and he can use scratch to control that. It's compatible with Lego, and also with the PicoBoard:
http://www.picocricket.com/picoboard.html [picocricket.com]
LOGO / Turtle Graphics (Score:4, Interesting)
Have you considered LOGO (or Turtle)?
It helps teach some basic concepts, while at the same time giving more feedback (which is good for kids). BASIC on a TRS-80 Color Computer and LOGO on a TI-99 4A were 2 of my earliest introductions to programming. I also learned about logic through some very old game that used many types of logic gates to solve various puzzles involving flow of power (I wish I remembered the name).
You could also pick up a copy of the board game Robo Rally, which is an amusing game that involves planning and visualizing instructions that you will be executing at a later time (with lots of uncontrolled variables screwing things up). While not being like actual programming, it's a fun way to exercise some of the types of thought patterns involved.
In my opinion, at that age, the choice of Language isn't really as important as just some of the basic ideas involved, such as sets of instructions, iterations and control structures, and logical decisions.
Re:Art of Assembler (Score:5, Interesting)
Re:Python (Score:3, Interesting)
Re:By Himself & Google (Score:5, Interesting)
Interesting approach, but there is also a theme that some learners need a guide so that the 5 stunning ideas they never thought of don't become warps to their understanding.
You said "don't spend money" - some of the new languages have free mini intro books. We can decide later in Language Wars about Python vs Ruby but for example Why The Lucky Stiff's Poignant Guide To Ruby looks stunning to capture the attention of an 11 year old with humor. That kind of thing is sorely lacking in most texts that feel they have to impress other academics. I have the programming aptitude of a gnat but I'll glance over that just because the sidebars are fun. From what I gather the programming content is well done, and a couple people have praised some of the language design mechanics of Ruby.
Re:Normally C but... (Score:5, Interesting)
I disagree. I was 10 when I started programming, and when I did it was in C. There are some advantages in being close to the hardware like you are with C, as opposed to the higher level languages like Java, Perl, Python, etc. Just like how everyone learns arithmetic by hand to start, but once that's mastered most people just use a calculator for anything they can't do in their heads. Without learning the manual process first, you wouldn't understand the guts of how arithmetic works. The calculator would just become a magic box that spits numbers out at you.
Just like with math I MUCH prefer to spend my time in a high level language like Perl or Python, but I'm much better at using them because of my early experiences with C. An example:
One of the early C programs I wrote was an implementation of Conway's Game of Life. It's a fairly simple program, conceptually, but it hits a lot of major gotchas in programming. At by "it", I mean me :)
- array bounds checking
- data integrity (you have to have a buffer array to create the next generation or you'll get very screwy results)
- array copying (pointers are both powerful and dangerous)
- static vs. dynamic memory allocation (free your pointers, kids)
All of these things can cause issues in most programming languages, but the bugs they cause can be a lot more subtle in some of the higher level languages.
Consider a one-dimensional array
C-style
int a[3] = {1,2,3};
int b[3];
b = a;
a[1] = 5;
*** b is now {1,5,3}
Perl style
@a = (1,2,3)
@b = @a;
$a[1] = 5;
*** b is still (1,2,3)
For this, Perl seems better since it matches what the user likely wanted to do.
However, now look at 2d:
C-style
int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
int b[3][3];
b = a
a[1][1] = 10;
*** b[1][1] is also 10
Perl-style
@a = ([1,2,3],[4,5,6],[7,8,9]);
@b = @a
$a[1][1] = 10
*** $b[1][1] is ALSO 10
Why the difference? Array assignment in perl only copies the top level structure, which happens to consist of array refs in the second case. So after the assignment both $a[1] and $b[1] point to the same array ref. If you're already familiar and comfortable with C pointers, this kind of bug is a lot easier to find and fix. You're less likely to make this mistake anyway, though, because you have that intuition that array copying is a hard thing to implement and that different languages will do so differently. So if you need to copy some kind of complex data structure, you better look into how that particular language does it.
I disagree (Score:2, Interesting)
He should read "C++, How to Program"
Why C++?
1) It is lower level than Python. Having a solid grasp of these lower-level concepts will make learning any other programming language easier in the future.
2) The sharp distinctions between pointer variables and regular variables, stack and heap, etc., will (when mastered) give him a solid intuitive grasp of the key organizational structures that DO support all other programming languages, even when the grammar abstracts some of them away. This will make it easier for him to troubleshoot broken code written by people who only have a high level understanding.
3) C++ is still in use and in-demand in a much wider variety of industries than Python.
4) He will be forced to deal with cleaning up his own data structures, which will ensure that his code stays clean after he moves to languages that have garbage collection. People who start with garbage-collected languages often forget to release their unmanaged resources in the rare cases that they are used...C++ veterans are much better about this sort of thing.
5) It is an unwalled garden, allowing him to do all kinds of crazy hacky things. He should get that worked out of his system as early as possible, and also get as much experience dealing with the problems hacky code causes, so that he won't be tempted to write like that (in ANY language) once he does anything serious.
6) His brain is young and nimble, making him more able to grasp novel, abstract, and difficult concepts. Dumbing things down for him would be a waste of his potential. C++ is harder than other languages, which is precisely what gives an advantage to programmers who have mastered it.
lisp (Score:2, Interesting)
Re:Python (Score:5, Interesting)
C will teach you how computers work.
Python will teach you how programming works.
Ideally, you want to know both. The question is just which one you want to learn first (and if you even want to learn about the other one.)
There's no right answer. My 8 year old daughter figured out Universal Turning Machines from watching minecraft videos*. If she wants education I'd probably teach her Python. But I could also see showing her NAND gates, working up to a general purpose computer, then C. It's all about her interests and aptitude.
* She ran into my room excitedly to say: minecraft runs on a computer. I can build a computer in minecraft. So it could do minecraft. I probed a bit, and she explained that it was just like a book ("Diary of a Wimpy Kid" was her example) referencing the book itself by name. Of course, her current career choice is helicopter door gunner, so nothing may come of this.