41 points · by atestu · 17y ago · 110 comments
First I thought of C because it will also teach him how the Linux he runs was made. But… I hate C. I personnally learned programming with OCaml and Pascal. I still love OCaml (pattern matching FTW), but it didn't really teach me anything about Unix…
I'm looking for a language that would be easy to learn, with a beautiful syntax, and that would gently introduce a 13 year old to the amazing world of Unix/Linux.
Any ideas?
JavaScript would allow your brother to share his creations with friends and learning the amazing (and at times frustrating world) world of the web.
Avoid languages like C++ or Java because there is so much to learn before you can produce a simple Hello World. There is no reason to learn OOP to do a simple task.
I think JavaScript would be a reasonable second language. He should learn programming firs before having to deal with browsers, the DOM model, and OOP.
Here's how to get a kid hooked on programming:
1. Programming should be fun.
2. Programming should be fun.
3. Programming should be fun.
Who really cares if a child isn't using "good programming practices"? When I started writing code, it was downright shameful.But in time, my internal desire to advance my art led me to nuking my globals and having some kind of naming standard. Eventually I fell in love with elegant languages.
Give the kid a fire. Let him decide if he wants to improve himself over time.
When I started, I just wanted to make games. Not learn Greek. Kids just don't care about Python or Ruby's elegance.
Also, it's easier to explain to someone if you have an interpreter going and they can see the results.
In some ways I almost think javascript in a browser is enough, you have firebug and its shell, and you can immediately show hacking around etc..
Of course, there are some who the mathematical pleasure is really what they are after, in which case I would think haskell - and it has the bonus of a very simple syntax that really doesn't look like a "programming language" - at least what most people think.
Good Javascript programming requires coding differently than you would in Python and C, you have to understand and use strange but cool features like closures and prototypal objects.
After Python, you could also try teaching him Scala.
There is a lot of explanation for any language, but with javascript there is a compiler/runtime on every computer.
I'm a stubborn bastard, only reason I kept going.
Python seems to be the teaching language of choice these days, and it lets you do useful stuff without getting in the way. It's certainly not the only language to learn, but I'm inclined to say it should be the first.
It's easier to code and deply GUI app in VB (and .NET environment).
For a beginner to start coding web-app in Python would be like a non-geek trying out Linux with just command-line.
Seriously, can we just nuke this argument?
I personally thought VB6 did a good job of letting you build something quickly in its day, in spite of its other faults.
These days though, I would recommend teaching him Python or Ruby.
Heck, there are plenty of situations where exactly this happened, and the programming language was COBOL or Assembly!
Does he play any games that have scripting languages? Lua's pretty popular. Additionally, there's TorqueScript, for the torque engine (garagegames.com).
If he's not a gamer, dump the imperative stuff & have him start on scheme or lisp. If you haven't broken your mind into imperative thought like most of us, it's actually pretty straightforward. And it'll probably fit well with the math classes he's probably taking right now. Teaching him how to solve homework problems in code can really drive usage.
If he's interested on the web side, generating HTML from a functional language is pretty straightforward.
Please, no PHP. Friends don't let friends do PHP.
I don't know which one is better for a 13 year old, just pick the one you know better.
My biggest recommendation, though, is that once the kid has any sort of "foundational" programming language under his belt, you write a Scheme interpreter together, in that language, and then show him that the interpreter you just wrote can run Scheme files that already exist (possibly ones you pre-prepared.) That's the best way, I've found, to burn into someone's head that there's no one-true-language, and to get their mind started experimenting with "what if the language was different in way X? Could I code that?" trains of thought.
The most important part in teaching a 13 year old programming is to let him have fun and a give him a sense of achievement. The rest will come.
And Ruby has a number of other benefits:
* Easy web frameworks if he wants to get into that (Rails, Merb, Sinatra, Camping, etc)
* Definitely fulfills the "beautiful syntax" part
* shoes for really easy GUI apps (that are portable, so he can show it off to his lame windows-using friends)
* Built-in powerful regexps for that pattern matching you expressed love for
* It's generally something that you'll run from command line, helping with the learning about Linux part
* Lots of cool libraries out there
* Object-Oriented, which at least for me was a very easy thing for me to grasp (especially compared to functional, which I'm currently trying to learn)
* Awesome
At 13, he may be too old for it, but Logo was one of my first languages back in elementary school, and I remember being very excited that I could write my own galaxian clone in just a day or so.
Otherwise, I would stay away from JavaScript and Ruby (I like them, but they are hard for beginners) and stick with Python.
Also, there are arguments that Lisp is better than everything else. Especially when the goal is to learn something (rather than get a product out the door, which makes it more important to have existing libraries, and to be able to hire people who know the language).
It's the most human-readable language out there. I personally think that it's a lot easier to get started with the basic concepts of programming like while loops, if statements, etc. It is a lot easier to do those things when you don't have to think about including random libraries and putting everything in specifically named functions (ie. main() or static-something-or-another in JAVA) and what-not.
It's the fastest way to get started.
This isn't going to do much to help with Unix/Linux mind, but as someone else pointed out programming is supposed to be fun.
Apologies for a (related) tangent but I'm in a very similar situation (except that my little brother is 31). He has more artistic inclinations but in the past he's demonstrated an aptitude for mathematics and is generally good at problem solving. I've been teaching him some basic set theory and number theory in preparation for some actually programming.
My first thought is to teach him one high level language like Lisp followed by a low level language like C. On the other hand, JavaScript (+ HTML) has some of the best of both of those worlds with the added benefit of affording immediate gratification. Any thoughts?
*Admittedly, my bro is a bit more motivated by financial considerations but I do think he will come to appreciate the beauty of programming if it is presented the right way.
For a 13-year-old who has probably not been exposed to much mathematical rigor at school, I would not recommend Haskell, though. Haskell makes it hard to write a program that, as ugly and unmaintainable as it may be, somehow mostly works (e.g. you have to plan ahead which parts of the program may perform I/O).
Therefore, I'd go with an imperative language and reserve Haskell for the day when he asks "is that all there is?".
C is mandatory, every programmer knows C, it teaches you about memory management, syscalls… it teaches you how you computer works. Once he gets it, he can start having some fun with the sexiness of Lisp, and he will make less mistake because he knows what's happening behind the scenes. Plus… it's really hard to learn C when you already know Lisp exists. I mean… first you ride a bike, and then a motorcycle.
For my brother, I don't think Haskell is such a good idea. Sure, it's a great language, but maybe too mathematical for his age (he just learned the Thales theorem…).
Good luck with whatever you decide though, he's fortunate to have a brother that's taking the job seriously :)
Monads can be motivated as a generalization of a lot of stuff that follows similar rules (the Monad laws). E.g. Lists, Haskell's Maybe (representing success/failure), sequential computation.
So maybe PHP would be better--tied with XHTML, CSS, and little by little some JavaScript. However, he's 13, so I don't think doing things in C or even Perl would be too daunting. (I can't recommend pure shell stuff with no graphics to people younger than 10 (sometimes 12) or so; it's just not that interesting for them.)
So then again Perl might be a better choice if you want to do a bunch of shell stuff. Have fun explaining cat.pl to him: #!/usr/bin/perl while (<>) { print; }
Also, I'd choose a language I like and that I'm familiar with. I think OCaml would definitely be a good start. Strongly typed and strict, lots of possibilities for abstraction, it's all pretty cool. Or teach him (and yourself) Haskell using RWH or something.
If you go for an imperative language then Ruby or Python would probably be a good idea. Those languages are really a lot like English and have a lot of momentum. If you go for Ruby, take a look at http://hackety.org/, I think it's awesome for young programmers.
Give the Why's Poignant Guide and you can't go wrong. Plus he'll love the cartoons, even if he doesn't get the strangely subtle adult humor.
I can't recommend enough getting him a "Basic Stamp" kit. Seeing how software can control hardware is magical. Then work him up into "Arduino" world in C.
I thought BASIC is very good to teach basic programming concept such as Loops, line-by-line execution, etc. Really, for a beginner, one must have that kind of mindset.
2) Numbering lines for programs is nonsensical.
3) Gotos are bad practice.
4) Most programs consist of more than 1 file.
5) Hello world is just as easy in any other (more useful) language.
Can't think of any more off the head right now, time to eat.
Didn't we all start with basic, even if just for a little bit?
Other than that, bare-metal programming on microcontrollers has the advantage that the boy can get a mental picture of the entire machine in his head; not so easy with an SDK of hundreds of megabytes for a modern high-level language.
"Hey, see if you can make those 8 LEDs do like the KITT car!"
One of the big "duh" moments when learning CS is when you realize that all languages consist of similar structures to let you get things done.
Not sure what his interests are, but I'd probably choose from:
Ruby or Python
Haskell or Lisp
Javascript
Maybe c or c++ too to remove the intimidation factor, even if it's just for Hello World.
After he can write simple 50-ish line programs in those three languages and knows a bit about how they work, zoom in on one of them and take things a bit deeper, and then a few weeks later zoom back out and see if he can "self-teach" himself those same concepts in the other languages.
This assumes he doesn't want to just jump in a build something for the web, in which case you have to decide how much HTML/dom/standards stuff to teach him (which is largely boring to newcomers) at the expense of doing some cooler programs.
Alternately, you might just want to use pygame and build a fun, playable game with him and not worry about too much theory until after he's having a lot of fun with it.
I'd push him toward PHP.
The goal isn't to make him a great programmer with an amazing language. The goal is to get him doing fun stuff fast, so that he sticks around.
When things are fun, kids stick around.
I'm guessing that many readers here got hooked on a language, not because it was a functional language, but because you could accomplish things quickly.
Introduce him to PHP and work with him on coming up with a very specific project he wants to hammer out. Then you can sit down and walk him through the various phases of putting it together.
Project sprouts (http://www.projectsprouts.com) makes it easy to get started in ActionScript and is also a good introduction to writing support scripts in Ruby.
What kept me motivated was that interactive programs were just an INPUT A$ and a LINE(x,y,x1,y1) away. Today, I'd have to write dozens of lines of GUI code just to get a program with input and graphical output.
You may want to check out Processing at http://www.processing.org/ which offers a bit of that good old simplicity.
'Processing was never intended as the ultimate language for programming visuals; instead, we set out to make something that was:
* A sketchbook for our own work, simplifying the majority of tasks that we undertake.
* A programming environment suitable for teaching programming to a non-traditional audience.
* A stepping stone from scripting languages to more complicated or difficult languages such as full-blown Java or C++.
At the intersection of these points is a tradeoff between speed and simplicity of use. If we didn't care about speed, it might make sense to use Python, Ruby, or many other scripting languages. This is especially true for the education side. If we didn't care about making a transition to more advanced languages, we'd probably avoid a C++ or Java-style syntax. But Java makes a nice starting point for a sketching language because it's far more forgiving than C/C++ and also allows users to export sketches for distribution via the web.'(quote taken from http://www.processing.org/learning/gettingstarted/)
C is a horrible choice by this standard, starting with the modify-compile-crash development cycle and especially once you get into manually managing memory.
It's not really coding per se, but HTML is a good thing to get a feel for whether you get a kick out of bending a computer to your will, and would let him show off his creations to his friends. He can also earn some spending money if he gets proficient.
After that he can get into JavaScript and maybe something like JQuery which makes doing more complex stuff much less tedious.
At that point he can probably decide if he wants to learn "real" programming, and you can introduce him to scripting languages, compiled languages and whatever APIs and frameworks he is interested in.
Some people here are concerned about "best programming practices" and learning certain lessons. He's 13. Just let him play, and if he likes programming, he'll continue learning.
I think your "let the kid be a kid" argument is valid though. It could be overwhelming and turn him off to the whole thing is coding appears to be too strict.
Btw, why do you hate C ?
I prefer languages that offers a certain abstraction, languages that allow me to concentrate on the algorithmic part of the program, the core of the application.
then js+jquery with firebug console as repl
(I took a class in which we used NetLogo to run agent-based economics simulations. Lots of fun, although the LISPer in you will start to hate it after a while.)
This site and JLogo are geared toward first time learners.
It is very easy to take oneself through the lessons and learn all the basics of programming. After going through these lessons, taking AP computer science (Java) was much easier for me.
(And if you are in the bay area, consider having him apply to the summer program: http://bfoit.org/)
Then again, just have him learn Basic. :-p That's how I learned.
More importantly you should concentrate on what can be done with code(e.g. create a blog, automatically search from library of congress or wikipedia, create a graph of his favorite football team etc etc).
People get hooked when they accomplish something...bothering about language or the finer nuances like memory leak etc can come later.
Ruby or Python is good for a start, because it's easy to debug and you can do simple, cool things with them pretty quickly. Then introduce him to Lisp or Scheme, and finally OCaml or Haskell so he's exposed to good static typing. Save C for later (by the time he's ready for it, he'll be picking languages rather than asking you for advice).
perl: practicality + fanatically helpful community, and it's in unix's dna javascript: nice skill, something you can make money in if you're good, immediate gratification on web pages haskell (or lisp): get some theory in there. i'd vote haskell because of the community