How To Teach a 12-Year-Old To Program? 799
thelordx writes "I've got a much younger brother who I'd like to teach how to program. When I was younger, you'd often start off with something like BASIC or Apple BASIC, maybe move on to Pascal, and eventually get to C and Java. Is something like Pascal still a dominant teaching language? I'd love to get low-level with him, and I firmly believe that C is the best language to eventually learn, but I'm not sure how to get him there. Can anyone recommend a language I can start to teach him that is simple enough to learn quickly, but powerful enough to do interesting things and lead him down a path towards C/C++?"
C# Surely. (Score:1, Interesting)
The problem then however, is everyting else will seem like a total PITA..
Re:Python (Score:2, Interesting)
You may actually want to be a little wary of languages like Python if you plan on teaching a kid C. It's a trap that I, as a young programmer, fell into with classic Visual Basic: the language is just enough that you get hooked on it and don't want to move on to something else. That's an important reason, at least in my book, why starter languages should be limited in their capabilities—that, and it makes a great learning experience for the kid to come back and complete his or her favourite language later!
tl;dr: Python is a great language to learn by, but so featureful that your kid may never give it up.
I wouldn't recommend BASIC (Score:1, Interesting)
And neither would others.
PASCAL.. mediocre choice. C, okay... C++.. if you insist.
Python: pretty good, Ruby, Ada: great, Haskell/SCHEME/LISP/ML: EXCELLENT
Parallax Propeller micro controller kit. (Score:2, Interesting)
FreeBASIC (Score:2, Interesting)
Re:Programming (Score:4, Interesting)
Interestingly along those lines someone has created a low-entry-barrier BASIC type language. Check out http://kidbasic.sourceforge.net/ [sourceforge.net]
Re:Python (Score:1, Interesting)
Get LabVIEW
www.ni.com
It's used alot for test engineering. Very useful programming language can do a lot of things with it. It;s a GUI programming interface, easily to learn. Like all programming languages hard to master.
Get a lego mindsotrm kit. It has it a GUI interface. You can get labview kit to program your mindstorm too.
Also Matlab is very good too. It like C, but more engineering focus. You can do alot of cool educational thing with it like slowing down sounds and stuff and do FFT on the data.
Re:plain C, python, or ruby (Score:5, Interesting)
So teach him assembler as a first language, and EVERYTHING else will look simple in comparison!
Seriously, start him with either the java console (system.out stuff) so he can do "Hello, world!", or start him with html+javascript.
Programming today isn't like when we were kids. In those days, you did whole applications with ONE technology and ONE package - dbase, clipper, turbo c, delphi, dbfast ...
Now? The database is decoupled from the app logic. The app logic is decoupled from the presentation, which could be a program or a web app. We wanted separation of the storage from the logic from the front end, and we're there. The kid will get more fun doing simple web pages that he can see results in right away (important to get that positive feedback going, or he'll go back to his psp or wii or xbox or whatever). html+javascript gives him that, plus you don't need anything to start except a web browser and a text editor, - not even a web server.
Lego Mindstorms (Score:4, Interesting)
Re:javascript (Score:3, Interesting)
It's a web programming language, not something a 12 year old should be using to have fun messing around and maybe trying out some 3D stuff.
That hasn't stopped people from trying out some 3D stuff [gyu.que.jp].
Re:Programming (Score:2, Interesting)
Storm
HTML and Javascript (Score:3, Interesting)
Seriously, start with HTML. It gets you instant results right away and he can see his work coming to fruition quickly in designing his own web pages. To really capture interest it can help to show the practical purposes of programming rather than making iot all so abstract. Lots of set up and initialisation just to do something can really blow out many new programmers, if there is a lot of tricky work to do simple things. HTML and javascript allow you to see results fast with little initialisation crap. Instant gratification can help capture their interest and the web page thing allows them to quickly realise the value of what they are doing. Write some HTML and publish it on myspace or on fortunecity for the world to see, tis instant payback.
Start to teach javascript and you get instant feedback. Javascript happens to be a very simple, clean, dynamic typed language perfect for a newbie. Show them how to use the javascript and debug console in firefox to debug their code. More instant gratification from making their own little web applets that can be made instantly available to world .
Re:Programming (Score:2, Interesting)
I found my TI-83+ plenty motivating during my boring math classes (boring because I already knew, or was able to pick up very quickly, the new stuff we were learning). :). I wrote exhaustive programs that covered every single possible option or method that I would need to use for solving various stuffs. So it was just a matter of navigating through the menu, punching in the correct values, and writing down the answer. That was fun, also hats off to the teacher for not penalizing (but rather rewarding) creativity.
So I created a bunch of programs to solve all the things we were going to cover on the test. My teacher said if I had programmed them, I could use them.
So I got to finish my test in 5 minutes and twiddle my thumbs while everybody else worked
I wouldn't worry about the fact that basic can be a mess-- he won't be creating anything large enough that matters. I usually knew what I wanted to program and could get it out pretty quick-- didn't need to bother with organization or "good coding practices". The important thing was that I began performing the mental exercise of having a nebulous need, and translating that into code, given the available options (IF, THEN, ELSE, STORE, etc). I tried picking up C++ when I was 12 but the syntax requirements were just far too much detail for me and were a huge barrier to entry. Basic didn't have any of that.
Then of course your kid can sell the programs to other students for whatever they're willing to pay.
It will be an important lesson for him-- he will find, at a very young age, what I did-- that people expect your computer skills and work and coding for free, and get frustrated when you tell them they have to pay (even just $5, in my case) for it.
Just some points to consider (Score:1, Interesting)
Having learned to program largely on my own at age 10 (on a Sinclair Spectrum with 64k ram and a ROM-based BASIC interpreter), I might offer a few points. They need or need not apply. When I started, computers were few and far between. I can't imagine that he would be at the level where I started - surely he's at least picked up an Internet browser and knows about the Internet, instant messaging and the like.
1. The starting environment should be something simple and clean. It shouldn't get in the way of whatever it is you're trying to accomplish. Unless the kid actually wants to become a Linux hacker (and I mean this specifically), start with whatever he's familiar with. A console-based environment is fine, since he'll need to know about basic file management very early. But don't start off with shell scripting. It's not gonna hold his interest.
2. Pick something that gets results soon. One of my proudest accomplishments in that day just let you control an 'X' character on the screen in a 'text' video mode (back when the paradigm was QAOP nod WASD). It might seem trivial, but you actually need to know a lot of basic concepts to pull it off: processing user input (hence IF statements), variables (to store your position), and dealing with the screen. In fact, I remember an 'epiphany' I had when I realized that the statement "LET x = x + 1" is a valid and important device, and not mathematical nonsense. Unfortunately, we live in the age of intricate console games with HD graphics, so doing something like that would not get the same kick today.
3. If possible, find a 'project' that's easy to start off with, but can be readily extended - another important aspect of programming. Take the above example. Once you have that, you can add target objects on the screen to be picked up - and start keeping score. You can think about how to extend it to two players. You can add walls that you can't cross, or teleporters, or other ways to modify the available paths. Later on, you can add a monster chasing you - say making one move every time you make one, and think about how to make the monster smarter, especially once walls set in. At its most basic, this is the stuff games are made of.
4. One can learn by example. I used to have books that consisted of collections of short programs (10-30 lines of code) that solved various simple problems. Eventually, he can learn to incorporate those into his own programs as they get more complex.
5. Interacting with the OS, networking, and even basic memory management like malloc are advanced topics IMO, and should be glanced over at first. I would have also included Web technologies in this, but I'd expect a 12yo to know his way around the Internet. Still, I wouldn't start with HTML (unless you want to teach him scripting instead of programming). I don't know Javascript well enough to comment, but I'd start with a more standard programming language. In retrospect, I might be inclined to start with a language that requires variables to be declared, because it helps to organize your thinking at the start.
6. Even though one no longer needs to solve IRQ conflicts, knowledge of PC hardware is still important - not to mention useful since pretty soon one can make money with it working for a local shop or freelance. Eventually, one can touch on that too. The basics of PC hardware haven't changed that much over the years, beyond the shape of our expansion slots.
7. Really, the most important thing is to get his attention at first. If he's a bright kid, has a natural curiosity about things, and has an aptitude for logical problems, you just need to get him started and let nature take it course. However, if he's more interested in sports or chasing girls, there may not be much you can do. Not everyone needs to grow up a programmer, after all.
Re:small asm, C, C++, python - in that order. (Score:3, Interesting)
Followup to my last post: another suggestion in asm-type space (if you don't want to start with electronics) is to download a corewars emulator (or perhaps a similar Robowars type game) and beat each other up in core/logic space for a while. I remember a real "aha" when I learned about Imps, Dwarves, and self-modifying code in general that way.
Does no one get it? (Score:2, Interesting)
My opinion? I've taught kids aged about 8-17 programming languages at summer computer camps for over 10 years, and I have otherwise been an educator for a while. Despite my own preferences and opinions, the truth is that unless you try to start someone out on INTERCAL, language doesn't matter. It's not like Bobby would have become a phenomenal programmer, except you erroneously chose Language X to start him off with, and he hated it, so he became a hair stylist instead.
If someone doesn't do well at all with C++, while BASIC for example might be less scary, in my experience it makes no difference to reapproach programming with the different language. At least as far as making a difference between having a real interest/performance, and the distinct lack thereof. If someone is going to "get" programming, they'll be able to get it with any common programming language. Period.
Furthermore, a kid's understanding of a programming language is going to depend much more on the quality of the tutoring/teaching/etc. methodologies, but that's another topic for another time.
I've built an 80s era 'lab' to teach my son (Score:2, Interesting)
I've built up a 'lab' with old Atari, and Commodore 8-bit machines. My son is learning Atari and Commodore Basic and Atari LOGO. For Christmas he wrote a Christmas greeting in Atari LOGO, which really required him to dig in to recursion and integrating the application's behaviour in to an internal mental model, so I'd call this approach a success.
I find it interesting to see the comments on PYGAME here...I'll have to investigate as eventually I'll want him to move to the next level where he is using 'modern' languages once he groks the basics and wants to do something that he can share with his peers via email.
Re:Python (Score:3, Interesting)
There's actually an interesting Agent-Based Simulation system based (loosely) on Logo called NetLogo (http://ccl.northwestern.edu/netlogo/ [northwestern.edu]). You can do basic Logo stuff, but it can actually do some very sophisticated modeling and the syntax is not very difficult.
Using syntax similar to Logo, you have program agents to sense their environment and then take action based on that. The concepts scale well to other platforms like the Lego Mindstorms.
It's not a traditional programming environment but as a beginner you'd still need to understand the idea of variables, objects, and conditional logic. Plus it's very visually oriented and has many examples that a kid can play with and tweak.
Getting their interst with simple fun (Score:2, Interesting)
One of the more interesting aspects is that anything that is done with the icons or Drag and Drop items can be done through scripting creating a nice staged approach to learning programming.
It was created by a professor named Mark Overmars as a teaching tool to get children interested in programming.
http://www.yoyogames.com/gamemaker/ [yoyogames.com]
It has very basic OOP functionality built in with child and parent objects, and you can actually create some pretty interesting applications with it. The problem is that is a bit too fun and you will need to encourage your child to use this solely as a launching pad and not a final destination.
Re:GNU Robots is a great start (Score:3, Interesting)
Thanks!
Actually, the original plan was to use a simplified version of assembly (based on 6502 assembly) to construct your robot. But I quickly realized two things:
I think you'd have the same problem with C or C++.
So I looked around for another way to do it, and found the Scheme interpreter (GNU Guile). Since my Robots program was already being written under the GNU GPL, GNU Guile seemed a perfect fit. It had all the hooks to make writing the rest of the Robots game easy, and users would be able to write programs in a language that already existed. From there, RMS accepted my Robots game as "GNU Robots".
The down-side was that I know nothing about writing LISP or Scheme programs, so when I was done writing GNU Robots, I couldn't create any robot programs with sophisticated algorithms. Bummer. That's why my demo robot programs in GNU Robots 1.0 were so simple.
I envisioned that someone would help me create a tile-based programming concept, where "actions" were represented by "tiles" (for example: "move forward", "turn right/left", "pick up object", "fire gun", ...). The programming GUI (basically an "IDE" for a GNU Robots program) would let you connect tiles to each other using "wires" (in the resulting Scheme program, it would be tail-recursion, similar to a "GOTO".) There'd be certain "if" tiles that would let you branch to other tiles (probably a combo tile like "look ahead, if enemy less than _ squares away..").
Alas, I wasn't able to pull that together. It's still not there, AFAIK, so if anyone wants to write such a thing, I'm sure the current maintainer would thank you.