Ask HN: How should I teach code to kids?
My little cousins are 7 and 9 years old. I have been thinking a lot how can I get them started with building and designing for the web.
I just finish my first attempt https://www.youtube.com/watch?v=BiwWT2CERA8
I wanted to ask the HN, what other ideas or what type curriculum I can do to make it more fun and interesting for them. All ideas are welcomed.
137 comments
[ 5.6 ms ] story [ 228 ms ] threadAlso moves into HTML, Python, etc.
I had great fun teaching using their curriculum. They're rolling out worldwide and all their materials are CC licensed.
I have the kids learn Python between age 9 and 11 depending on when they are interested. We write games and learn the fundamentals of CS by following the curriculum of Rice's "Introduction to Interactive Programming in Python" class designed by Rixner and Warren. It has a Python interpreter and game library that compiles in-browser into javascript, which is a very helpful design for a first class, and for sharing their results with myself, their families, and each other.
Afterwards I encourage those who really enjoy it to learn Java, also using web sources primarily. I intercede when they are stuck but generally they help each other out.
Some of them used to use the Java to write Minecraft mods but that has become a bit more tricky.
There was one student who started to learn Java at age 7, but in general that's too young. If you push things too earlier they don't get a head start. They get burned out and don't want to have anything to do with it any more. You really need to be sensitive to what they are interested in and let them lead.
Most kids when they see others making their own games want to try their own hand at it themselves, so I have managed to create a self-perpetuating cycle.
Learning languages to make games makes sense. Pushing languages to force concepts will be resisted and is counterproductive.
The games approach is nice too because they rapidly learn trigonometry, basic physics, and linear algebra by age 10 or so, and are teaching themselves Calculus on Khan Academy by age 12, as well as researching optics, writing their own shaders and generally doing what most would consider college or graduate level mathematics. Their Java skills also often lead to writing for Android. Some selling their games and other software at a certain point, which helps their families.
It helps that on the reservation I have a great deal of autonomy in what I can do. I've worked in public outside schools before. None of this would be allowed there.
I don't really care for the idea of dumbed down toy languages that can't really be used for production software. Python and Java are well designed enough that they are understandable and usable from the age where they are able to do programming thought. Python is a simpler one to read and use and so we start with that. But Java is very similar and the lessons of Python directly transfer. Java ends up being much more useful for distributable and saleable software, though it is harder as a first language.
https://brython.info/
Comparatively, other languages, like Python, will throw sane exceptions and a meaningful stack trace when something goes wrong.
Python is dead simple—I recently had to take on a project written in it having never programmed in Python before and I essentially did not have to learn it to get the feature done.
I might give Python an edge for a number of reasons (a shell is a simpler environment than a browser in a number of ways, some of the language features are cleaner), but to say that it's much harder doesn't bear out with my experience. Capable first-timers become productive at about the same rate.
I've found it's mostly experienced developers who trip over JavaScript, because they're carrying a set of expectations and are weirded out when it does something different. Turns out principle of least surprise means different things depending on people's backgrounds.
Feel free to choose to start someone with Python if you prefer it, or if they're likely to want to work in a domain where it makes sense (say, data science), but it's probably not going to change your learn-to-code outcomes much.
>distributable and saleable software
Do you or they make the Python code into an EXE for sale, using one of the available tools, or sell as source?
They also offer free teacher and student accounts with the ability to limit time. Can't say enough positive things about the service.
Sample to move 1 step:
function move(steps) {
}move(100);
becomes
move(500);
I don't know haha, do they even want to code in the first place.
Doesn't even consider requestAnimationFrame or proportional scale. Also I'm starting to realize jQuery is pretty big even the min version especially on slow networks.
CoderDojo in an NGO that has spread globally. I wholeheartedly recommend it.Just don't leave your notebook lying around, or some curious kid might take it apart.. (no joke)
[1] https://coderdojo.com/
I agree with the other comments in that they need to be interested first. Well, how do you get them interested? That depends on their interests and hobbies. So what I would do is create a short video that ties one of their hobbies to programming, and try to discuss what they thought of the video. Once you get them hooked, they'll be ready to learn.
It's basically a UI for writing/sharing/leading code exercises.
It should obviously be using a database and have better security, but that wasn't a major priority for my original purpose.
https://github.com/katzgrau/hour-of-code-developer
It's a 3rd person view where you control an astronaut on different missions. It has some RTS elements as there are various robots to control.
However, in addition to being able to directly control the robots (which is fun and accessible), you can write code that it'll execute and automate some simple tasks, like fetching resources, defending a base, etc. It's very high quality and well made, and incorporates step by step lessons, starting with basics of programming. Your creativity is the limit.
What I've found out recently is the game was eventually released as open source (it was originally commercial) and picked up by a community of people working on making it better, and it's suppported on modern systems.
It's called Colobot [0] and I highly suggest you try it out, see if you think the kids would find it interesting.
[0] https://colobot.info/
For younger kids I only recommend Scratch Jr. since it is natural, has less friction, and doesn't require reading.
[1] https://www.scratchjr.org/
[2] https://www.alice.org/
I am also a fan of hour of code ( https://code.org/learn), it uses popular games and Disney characters and typically no project takes more than an hour.
We've recently started to teach kids with the use of Aidlab (https://www.aidlab.com/developer) to show them some basics about heart, lungs or motion data. They are able to measure themselves, develop simple apps thanks to Unity engine, and make use of those data (ex. building games that use respiration level to control game character).
https://www.amazon.com/Lauren-Ipsum-Computer-Science-Improba...
* You don't need any complicated stuff for it, just printing to stdout and reading from stdin.
* Kids love making up stories and games
* When they understand the basics you can gradually increase the complexity: Add if/then/else conditions (do you wanna go left or right?), functions (e.g. to parse answers to questions), variables and simple arithmetic (treasures found, monsters fought, ...) and libraries (e.g. for adding randomness to the game).
And if they're hungry for even more afterwards, you can add some graphics programming into the mix. By then they should be motivated enough by their story that they actually want to learn something more complex and challenging.
I'd recommend a scripting language to get started, as it removes the need to compile code, which (IMHO) just adds unnecessary complexity.
Not sure if this is the best approach, I tried it once and it worked great though!
Or use a REPL (eg repl.it)?
I wrote a book to teach 7-11 year olds to code in Python and Scratch and teach them some computer science along the way - I read a few other books out there first, and there's a lot of "just copy out this code and things will happen", which is exactly what I tried to avoid in this book.
The reviews: http://www.goodreads.com/book/show/28232614-coding-unlocked#...
The book: https://www.amazon.com/gp/product/B013R4OFVA/ref=x_gr_w_bb?i...
I was impressed with how quickly he went from "just tried this at school" to "leave me alone, Dad, I know what I'm doing here".
Seems like a good intro for kids.
The game is pretty amazing in that it teaches pre-reading kids how to "code" by presenting it as a puzzle that you add pieces to. Really well done.
It looks quite good, but does anyone here have any first hand experience with it? I'd love to hear an honest review.
https://bitsbox.com/
The first contact I had to actual programming was messing with Pawno scripts to make gameservers in San Andreas multiplayer when I was 12... Spent hours and hours programming with it. It started simple placing coordinates where the cars should spawn until I started to mess with more 'complicated' stuff like gates that open when player get near.
I would get some game that is popular among kids that age (minecraft?) and teach them to make simple modifications, if they like they will try to push themselfs to make harder and more complex stuff, the reward/work ratio is bigger than make a game from scratch on HTML, where there is a lot that needs to be done before getting to the "fun part".
Many of us who grew up around MS-DOS had to figure out ways to get around the 640kb base memory limitation and deal with conflicting IRQ ports. Did we want to do that? No, we just wanted to play Dune II. But through that, it got us tinkering with installing new programs, tinkering with configuration files, and eventually learning BASIC, putting together your own computer, etc.
Unless the kids are extremely mature and patient, the best way is to focus on an appealing end product. Don't present it as "oh, let's learn about boolean operators" today, as much as "hey, want to build a [something cool] together?"
And you know what? It may not stick; maybe they'd rather be outside, bake some cookies, or beat on some drums, and that's fine, too.
the rest of this is just me criticizing things I used and didn't like, so feel free to ignore
I tried reaching a friends' kid programming with Scratch and making any kind of more complex stuff was actually too hard because of the "simplifications" built into the language. Can't remember the details, but you had to use globals instead of passing parameters for something basic, like constructing objects.
[0] processing.org