
Ask HN: How do you teach kids to program? - sbmthakur
Some context: My sister is 12 years old and her vacations are coming up. I was thinking about teaching her some programming. She has some basic understanding of computers and knows what programming languages do(she has some idea about if-else and loops but she can&#x27;t code yet). I would like to get some pointers from the HN community regarding the same. You could suggest me a programming language that kids take up fast or any programming related game(kids like it to be fun!). All other kinds of suggestions are welcome.
======
Rjevski
Kids or not, I would recommend starting with a problem to solve.

Programming by itself can be boring and is definitely not as rewarding as
other stuff (games, etc) especially if you’re just a beginner so learning it
“just because” is going to be a hard sell.

Find a task or a problem she’s having that she’s currently doing manually and
help her automate it.

~~~
rraghur
I've been trying to get my son interested. He's in the same boat... Knows a
little about conditionals and loops etc but hasn't caught it yet.

He wanted a RC car.. so I asked him to pick an old one apart. Taking parts
from that, he built one without steering and just on off control. So now I've
got an esp32 and a servo and got trying to make a steerable rover.. he's not
going to get all the programming but he's definitely interested.. also the
mechanical parts are also pretty interesting and approachable for him (we
burnt a couple of hours trying to make a steering mechanism with LEGOs and
didn't get anywhere)

I'll start him with prettifying the web page and adding bells and whistles
(calibrating the servo, displaying connected/disconnected status etc and
whatever catches his fancy)

Fair warning: requires a lot of time and patience.. also go slow (very hard
for me to do).. but yeah, this is the time he's gotten the most interested

------
baliex
I just started with Processing for the first time yesterday and it got me
thinking straight away that it'd be good for this sort of thing.

It's super simple to get started with, just a single download gives you a
(very basic) "IDE" with loads of examples built in (ranging from very simple
to pretty complicated). The other thing is that it's all very visual from the
get-go so you can really see what you're doing.

------
TheAsprngHacker
Other people recommended Scratch, but I personally think that it's a poor
educational programming language. It's extremely limiting and lacks
abstractions such as script-local variables, procedures that return values,
and a first-class way to group data. As a result, people pick up poor
programming practices such as storing results in global variables or using
strings for compound data.

Snap! ([https://snap.berkeley.edu/](https://snap.berkeley.edu/)) is based on
Scratch and Scheme and features local variables, lambda expressions, and
first-class lists (both Scratch array style and Lisp linked-list style). You
could also look into Racket ([https://racket-lang.org/](https://racket-
lang.org/)), another language similar to Scheme. Both these languages have
multimedia capabilities that make them attractive to new programmers and a
more sensible design that better captures the essence of abstraction and
composition.

------
nicolashahn
I would try PICO 8. I'm unsure if 12 is too young, but it'd be great if they
have any interest in games. I made my case a couple weeks ago, pasting it
here:

When I was a kid, I was heavily into video games and had a burning desire to
create my own. However, the options for doing so were not great. One of my
middle school teachers tried to introduce us to programming via creating Space
Invaders in perl, which went as well as you might imagine. There were a few
GUI game making applications that were all terrible and extremely limited. I
eventually managed to make a game using Flash, but all the overhead of arcane
Actionscript APIs was overwhelming and discouraging. I stopped programming and
for several years thought I was going to go into media, creating films and
animation. I eventually picked up programming again in college, but there were
many years of programming experience I could have had if I had stuck with game
dev.

I'm convinced that if PICO-8 existed when I was originally interested in
making games, I never would have stopped programming. PICO-8 is the perfect
balance of easy-to-learn and powerful. Lua is a good first language because
it's so small, and encourages you to build your own solutions rather than rely
on magical libraries. For example, I never knew how a list-shuffling algorithm
(Fisher-Yates) worked until I needed to write my own because Lua and PICO-8
don't provide one.

The limited sprite and sound options encourage you to spend time not on the
assets but on the gameplay (the code). It's quick to get things on screen and
working because the PICO-8 API is simple, logical, and not arcane (cough
Actionscript cough).

Basically, it introduces programming in an instant-gratification way that's
able to grab and hold a child's attention, while still being powerful enough
to produce games that aren't hamstrung by toy programming languages.

------
pdm55
Also
[https://news.ycombinator.com/item?id=16464909](https://news.ycombinator.com/item?id=16464909)
and
[https://news.ycombinator.com/item?id=13499626](https://news.ycombinator.com/item?id=13499626)
how to teach kids to code - resources

------
kris99
My daughter started with code.org and logo when she was 6. Then she tried
scratch 2 years later. Now she creates minecraft modes with mcreator and some
simple games in unity. Just remember not to press her too much. Most girls
learn programming in more creative and less technical way. Try to make it fun.

------
alimw
I would use Elm. The language itself is very high level, but designed to be as
simple as possible. I think that's ideal for a child still far from the job
market, who might never need to learn how to do all that bit-twiddling that
programmers don't even realise they are doing most of the time. [https://elm-
lang.org/](https://elm-lang.org/)

But you'd have to do some work to assemble resources and learn how it works
yourself. Examples of the kind of stuff you can start with at
[http://outreach.mcmaster.ca/showcase.html](http://outreach.mcmaster.ca/showcase.html).
Anything you make can be published to the web.

------
shortlived
My son built a simple web page. Writing HTML is a great entry. Then we will
build up from there.

------
badsavage
I show them how simple could programming really be
[http://kids.klipse.tech/](http://kids.klipse.tech/)

------
beatgammit
I've heard Scratch is nice, and my library has some fun looking books about
learning programming (I think with Scratch). You can whip together a simple
game pretty quickly, so if that's what she's into, that could work. I plan to
teach my kids using Scratch when they're older, but that's several years off
so I don't know the specifics yet.

Scratch may or may not be the right answer though, depending on what she's
into. Python is fantastic, but I don't see it being very good for getting
something graphical working in a short amount of time (that's what usually
keeps a child's attention).

------
a-saleh
I can talk from my own experience, as I learned programming at similar age
(like 17 years ago) :-)

* I learned with Visual Basic For Applications, because the IDE was bundled with every MS Office installed, so there was no setup required.

* Visual Basic was comprehensible enough for me as a 12yo. I had some basic understanding of programming from my dad showing me basic on some vintage Yamaha computer with arabic OS [1], so IF-ELSE, PRINT, GOTO 10, but couldn't code yet :P

* I remember that the path to hello world in VBA was fairly straight forward. It didn't take too much of typing to get a MessageBox with "Hello World" on screen. I think after that we were writing few programs with multiple messages after each other telling a short story or something.

* I remember after first few lections, we enabled the 'option explicit' that enabled some rudimentary type-checking (or was it just requiring explicit variable declaration?) and I didn't like it at first, but after it started catching typos in my variable names, I grew to like it :) Static/dynamic typing proponents take that for what you want.

* I remember we mostly did simple text-based programming. Million Message boxes and Input boxes. Simple quizes. Simple verbal puzzles. Simple calculators (no parsing, you entered first number in input box, then operator in second input box, then second number in third input box, and finally answer in message box would appear.) Making poem generators was fun. Maybe some simple text-based adventures. I remember having fun :) I think it took us half a year or more to start working on some graphics and making simple games?

* the learning was pretty hands on. We were a group of 5 to 10 kids in a class, everybody was trying to do the same assignment.

* I remember it took me a while to realise I could do "x = x + 1" in my code and what that meant :D In math (we already were solving simple linear equations at school), it wouldn't compute. Functional-programming proponents, take that for what you want :-)

[1]
[https://www.msx.org/wiki/Sakhr_AX-350II](https://www.msx.org/wiki/Sakhr_AX-350II)

~~~
alimw
> I remember it took me a while to realise I could do "x = x + 1" in my code
> and what that meant

That's the sort of thing I called bit-twiddling in my own comment. Some of
these ideas get so ingrained in older programmers that we forget how much
mental overhead they involve. I only got a sense of it myself after I returned
to a somewhat imperative language (Python) after years of using functional
languages.

VBA is great if you want to make spreadsheets do things they couldn't
otherwise.

------
pdm55
For older kids, I like this interactive javascript book [https://software-
tools-in-javascript.github.io/js-vs-ds/en/](https://software-tools-in-
javascript.github.io/js-vs-ds/en/) and this simple set out [https://software-
carpentry.org/lessons/](https://software-carpentry.org/lessons/)

------
tmaly
I have been working on a set of tutorial to teach kids programming with
Scratch. I taught my 5 year old how to program using the new Scratch 3.0.

I would highly recommend trying it. The visual format is easier to grasp and
you can have a lot of fun making games and animations.

You can add her own voice or pictures right into the stage.

I have not tested it on a tablet, but I think it should work as it is not a
web based platform in the 3.0 version.

~~~
thirstythong
Would love to see this product tmaly!

~~~
tmaly
I am slowly working on it. I have a new baby, so I had to pause for a bit.

What is the best way to reach you when I have updates?

------
packetpirate
Get a Raspberry Pi for her. The latest images of Raspbian come with a pre-
installed Pi edition of Minecraft as well as Python libraries for modifying
the game world on the fly and making mods. There's also a book by No Starch
Press called "Coding with Minecraft" I've heard good things about.

~~~
zapzupnz
Just a note: any book about Minecraft won't apply to the Pi Edition, which is
a specially-made edition based on a _very_ old version of Minecraft.

------
steve_taylor
If she has an iPad, take a look at Codea. It uses Lua and is focused on game
development. There are plenty of bundled examples. I created Pong in a couple
of hours, without having used Codea before. It really helps to have a
bluetooth keyboard so that half the screen isn’t taken.

------
zapzupnz
code.org has really good programming resources and activities, including some
basic Scratch-like games that teach the basics of algorithms with Disney
properties and so on. Go to code.org and look at the Hour of Code stuff.

------
ecesena
I've heard great things about the microbit:
[https://microbit.org](https://microbit.org)

------
pknerd
Flowcharts are way to teach the logic. Since it's a kind of art, kids like it.
At least mine 8yo likes it.

------
momentmaker
[https://scratch.mit.edu/](https://scratch.mit.edu/)

------
pdm55
Coding 4 Kids [https://www.tynker.com/](https://www.tynker.com/) tynker*
[https://www.computerscienceforkids.com/beginningvisualstudio...](https://www.computerscienceforkids.com/beginningvisualstudio..).
C# + SmallBasic curriculums*
[https://www.codingkids.com.au/careers/](https://www.codingkids.com.au/careers/)
coding 4 kids - careers
[https://makecode.com/#about](https://makecode.com/#about) Microsoft – make
code*
[https://github.com/robotopia-x/robotopia/](https://github.com/robotopia-x/robotopia/)
Github for Robocop

[https://developers.google.com/blockly/](https://developers.google.com/blockly/)
Google Building Blocky with Javascript

[https://computationalthinkingcourse.withgoogle.com/unit?unit...](https://computationalthinkingcourse.withgoogle.com/unit?unit..).
chat bot

some other coding sites found by me, a science teacher:
[https://studio.code.org/s/express](https://studio.code.org/s/express) I like
this - it's easy - if I am required to teach middle-school kids some coding I
will probably use this;
[https://www.computerscienceforkids.com/beginningvisualstudio...](https://www.computerscienceforkids.com/beginningvisualstudio..).
curricula for SmallBasic, C#, Java, VisualBasic for kids+ ;
[https://makecode.com/#about](https://makecode.com/#about) Microsoft IoT +
coding for kids
[http://interactivepython.org/runestone/static/thinkcspy/inde...](http://interactivepython.org/runestone/static/thinkcspy/inde..).
Interactive Python; [https://www.lazarus-ide.org/](https://www.lazarus-
ide.org/) Lazarus = Free Pascal - some teachers use this;
[https://jsfiddle.net/](https://jsfiddle.net/) some teachers like this -
nothing to install, code Javascript online;
[http://happyfuncoding.com/](http://happyfuncoding.com/) the one site I can
always remember the name of;
[http://physics.weber.edu/schroeder/html5/](http://physics.weber.edu/schroeder/html5/)
am I allowed to love Newton's Cannon, written in simple Javascript on one
page?

------
magma17
I would start with C pointers.

