Ask HN: What programming language should I teach my child?

7 points by machinerychorus ↗ HN
Should I start them off with js, since they can get quick feedback and interactivity in the browser? Or should I start with rust, since that will teach them more about how computers work on a fundamental level?

17 comments

[ 0.33 ms ] story [ 63.3 ms ] thread
I'd recommend starting with Scratch, then moving on to Python with Thonny.

Turtle is a fun thing to work with. https://docs.python.org/3/library/turtle.html

Would avoid anything tedious, learning it all is hard enough already.

Python for sure.

The stdlib in python is full featured and you can do a lot with it and the syntax is easy.

Rust would be a terrible choice, the last thing a child wants to do slam their head against the wall with life times.

Whatever you choose make sure the feedback loop is tight. Children will want to "build" something, not fight with error messages.

You should definitely focus on quick feedback early on to get some basics about programming down. The specifics can come later. I would recommend something even simpler than JS or Rust at first, like Scratch, FreeBASIC, or PICO-8 (PICO-8 is $15, but may be well worth it)

https://scratch.mit.edu/ https://www.freebasic.net/ https://www.lexaloffle.com/dl/docs/pico-8_manual.html

FWIW Pico-8 uses a modified version of Lua as it's programming language. I would second that (Lua) as a good first choice as that knowledge can be reused in a lot of other kid-friendly environments.

Edit: ...and later other more practical general purpose programming environments.

Start with rust so they can get front page on HN. - Jokes aside, Free Code Camp[0] is a great resource for beginners and will help them learn basic concepts without block coding.

I would say quick feedback is important to make the learning rewarding and fun.

[0] https://www.freecodecamp.org/learn/

How old is your child? If they're between 10 and 14 years old you can teach them Hedy (hedycode.com) ! A gradual programming language that's easy to learn and transpiles to python!
Depends on how young. Logo if they're in elementary school; it was designed for children of that age. A large number the students I teach started with Logo as children and went on to learn other languages.
I think Logo gets a undeserved reputation as a "kindergarden" programming language, when it's actually a nice Lisp dialect. See Brian Harvey's "Computer Science, Logo Style". Available for free for personal use (as in free beer) at:

1. https://people.eecs.berkeley.edu/~bh/v1-toc2.html

2. https://people.eecs.berkeley.edu/~bh/v2-toc2.html

3. https://people.eecs.berkeley.edu/~bh/v3-toc2.html

(edited for better display of list of links)

While what you say is true about Logo being a good lisp, I would say the reputation it has is not undeserved but instead intentional due to the target audience of the turtle graphics system. The lisp-ness is incidental — I wouldn’t try teaching kindergarteners Clojure.
Personally, I started on Khan Academy's coding lessons. They teach Processing JS iirc. I don't think it really matters what you teach them first, but definitely have it be something that allows them to draw and move shapes. I think that's what motivates many early programmers.
I would go with JS, HTML, CSS. You can create games with it easily.
Historically, I would have suggested starting with lower-level languages such as C and a bit of assembly, then building up from there as the added expressiveness is much appreciated and understandably less direct. This all made sense when hardware was many orders of magnitude slower than it is now, even a phone running on a battery is more powerful than workstations of those days.

I would say the question isn't exactly which language to learn first, but rather which programming style. After a long career developing software, my opinion for new developers is to learn programming in a functional style. Not necessarily with a proper functional language, but one where it's natural to use immutable datastructures, only assign to local variables once per scope, and for longevity support concurrency. One element that could be deferred until later is static typing. Another important element is that there shouldn't be a main concept of fine-grained execution steps. By this I mean the typical for-loop or iteration variables. This whole premise is forcing humans to 'play computer'. We have powerful computers now, we can have computers, 'play logic' at a higher level without thinking in what amounts to be higher-level-machine language. A good example is using map/reduce/takeWhile/etc forms rather than for/if constructs. With those we can write one-liners that are one-level higher replacing entire block-control structures, and they can be chained on the same one-line, or over multiple lines in a flat, not nested structure.

The great thing about thinking this way, is that you can apply the same thinking and writing even when using procedural languages resulting in cleaner code without off-by-one and other edge case errors. Two languages that could fit this bill and be relatively mainstream are Elixir and Clojure. I think Elixir would be a great choice, as it together with the Phoenix framework is a reimagining of Ruby/Rails. Clojure is fundamentally small, but its usage can quickly become esoteric.

I also wouldn't go heavy on the js/css and learn just enough to get stuff done. When ready try to get exposed to using static types via TypeScript or a functional language like F# to see what they're about. Java, Kotlin, or Dart (with Flutter) might also be good mainstream choices but they tend to be less functional. You can try but the ecosystem (especially jvm) tends toward more OO and mutable data/state.

One completely different good candidate is Go. It has static types, is lowish-level like a C of today with garbage collection. There isn't a full framework though so you'd be pulling together a collection of libraries to make a web app. Having something opinionated leaves you with fewer questions when starting out. Still great if making command-line utilities, networking, or text (not graphical) apps is of interest.

If you have to do this, which you really don't, but if you do, start with cooking recipes, move on to algorithms, and the pseudocode. That is all.

Guys always get the family wrong. Always. The father's task is not to raise and edify the child. Your task is only to support your wife and the mother of your children. Bonus points for loving your children. But let them do whatever the heck they want, and keep your mouth shut, because it isn't your problem and it isn't your job. Your problem is your wife. Other than providing for your family and doing your husbandly duties, you can change the oil, pay the bills, and keep the house secure and energy efficient. It's when people overreach that problems occur. If everyone would just do their jobs, things would be fine. But instead we have OCD control freak fathers that want to live their children's lives for them. Back off before you do serious damage, and just be happy, and if you can't, maybe talk to a psychologist once a month.

That's an interesting tangent.
It's also the tried and true method a family remains functional and successfully raises children to become psychologically healthy and responsible adults. But every new father wants to reinvent the wheel like it's an egotistical matter of his choices. This is how kids get screwed up, the extremes of no father and too much father. Kids with friends as fathers turn out to be real assholes. Father should just sit in his chair, read his paper, watch his news, and be bored out of his mind, but you know, ready at a moment's notice to discipline at mother's request, or to rush a broken arm to the emergency room, or just be positive and supportive when things don't matter, and it is so rare that anything actually matters.