Ask HN: How to best teach a group of children how to code?

257 points by jiblyyyy ↗ HN
Hi HN!

I run an education focussed r&d shop (www.jibly.com) and regularly work on mobile app projects for large firms.

This year, I wanted to start teaching a group of underprivileged children (orphans, refugees, etc) anywhere in the world, how to code for every commercial app project I do for companies.

So for every app project I get, a group of kids gets the tools and resources to learn how to code.

I'm thinking of donating laptops with pre-installed child friendly coding environments. Including books, manuals., etc..

What are some great ways to teach groups of children how to code, without being present every day?

115 comments

[ 1.9 ms ] story [ 282 ms ] thread
Check out what linda luikas does. Her work is amazing
Adding a bunch of her books to the mix is a good idea! Tnx
Games! Find games that the players can extend it with programming. It is the best way to make kids interested, imo. At least was what attracted me (games & animes).
Game hacking. I like it. Will be introducing them to Scratch obviously
Box Island is a good intro to programming that includes loops and conditionals. It's a video game, with some beautiful graphics.
Without being present? Partner with other organizations that are present. At Coderise.org we discovered that the most valuable part of our after school 8 week program for teens was the time with the mentors that also serve as role models, those relationships are kept for years after the program and that's how the kids continue on a path of software engineering, participate in the local engineering meetups / community and end up studying engineering, building startups, and giving back
Teach them how to solve problems before you even start talking about code.
Logo -- it helped me learn when I was younger. The best part is as it is visual, kids can see how what they type changes what happens on the screen. It gives them instant feedback in to learning how to give machines instructions. This software can be loaded on any laptop or other computer. It doesn't require any crazy hardware either. https://en.wikipedia.org/wiki/Logo_(programming_language)
+1. Recommended Logo myself in this thread. And since it supports recursion, you can even draw Sierpinski triangles and such-like curves easily, and so introduce them to recursion.
I taught a group of 9-12 year old basic logic and algorithms using Scratch to animate a scene.

One kid wrote a basic brick breaker and another pong. They all seemed to enjoy the process since it's pretty straight forward drag/drop logic.

https://scratch.mit.edu/

Agreed. I taught a CS club to 4th and 5th graders during college and they all loved Scratch. It's very easy to get going with audio, images, animation, etc., which got them really interested quickly. Even for older (middle school aged) kids I'd probably start with Scratch because it teaches most of the CS concepts you'd use in any other language, but doesn't require the tedious environment setup (editor, compiler/interpreter, etc.) that "real" languages need. Spark their interest using the concepts, then sprinkle in the boring parts.
Linear programming on paper first, then linear programming by code. I have no idea how to do that one with kids, without being present (since I barely managed to do it with adults, while being present).

Doing it on paper by hand first is more important then it sounds, so they can really understand a)what they are coding, b)how fricking awesome computers really are.

How do you teach linear programming with more than two dimensions to children who don't know linear algebra? Why would a child be interested in linear programming?
Very timely - I am teaching students ages 8-12 & 10-15 coding this summer.

I've been planning on using Mozilla's Learning program (https://learning.mozilla.org/en-US/) a shot.

It's 2 separate sessions (1 for each age group) and 2 weeks in total. I have already outlined my plan based on it that I'm happy to share.

Does anyone have experience using their platform - share some thoughts?

I've done this for several years. Here's what I've learned.

TLDR: Focus on getting them to have fun & enjoy learning about 'code'. Don't care so much on how well they learn it.

Every kid is unique & will respond to different things.

Social & mentors are awesome. It's usually more fun to build with others if possible. Also they will want to easily share & show off their creations with others.

Show them how to "hack" Google with the browser's dev inspector tools. Wins them over every time.

Give them simple partially completed programs that they can modify. I've had a lot of success with a simple trivia game that lets them start by modifying the questions/answers & the replies it gives. A great first lesson in how to use strings & gets them looking at the code. They can then share what they created with others (social aspect) & have them play their game.

Do NOT lecture to them or try to do long demos. They often listen to teachers lecture all day long. They want to have fun & explore. They also don't care about types or any other computer science terms until they've created a lot of things & are trying to figure out why they don't work.

I've had decent results with Scratch. For pure beginners though, still start them off with a semi-completed program.

+1 for the DOM Inspector. I have found that kids LOVE pulling back the curtain on a website to see the wizard and play with the code. A fun activity is to have them go to a news site and have them edit the headlines and replace the images to silly things and take screenshots to share with their parents. What really impresses me with this exercise is how quickly some kids will figure out some intermediate hacks when they learn how easy it is to google the things they want to do.

Another suggestion that works for the same reason is to give kids code to play with. I've wasted 20 minutes of class time having kids write a three line "Hello World!" javascript program from scratch. All this did was irritate and bore the kids out of their minds as they struggled with syntax and hunt-and-peck typing.

Instead, when I give kids a great big block of javascript code that does something fun and animated, those kids will go wild with it. This is because changes to different variables can have big effects. They quickly learn to read the code and identify what different parts do. They break the code, and you show them how that's a good thing and how easy it is to revert it back so that it's working again. Code should be a playground. Give the kids a rich playground to run around in.

I think you said that better than me. I'm stealing this line as it's to good not to - "Code should be a playground. Give the kids a rich playground to run around in." Let me know if you want me to credit it to you ever.
Well there's a reason we refer to virtual environments as sandboxes!
Just something that came to mind reading this great comment, have you considered using webcam + canvas manipulation for that great block of fun Javascript? I've been doing Javascript30 (https://javascript30.com/), and day 19 (unreal webcam fun) he showed doing live image filters with simple pixel manipulation on a canvas populated by the user's webcam - it was awesome, I think kids would love it, and it lends itself really nicely to your model of a pile of variables to play with and break. That course is free (no affiliation but it's awesome!) and all the code is on Github, the webcam one is here: https://github.com/wesbos/JavaScript30/tree/master/19%20-%20...
> Instead, when I give kids a great big block of javascript code that does something fun and animated, those kids will go wild with it. This is because changes to different variables can have big effects.

I remember being a kid and typing in Mandelbrot code from a BASIC computer magazine. Even though I didn't understand the code, I had endless amounts of fun with stuff like that for exactly this reason.

It's what sparked my imagination and interest in programming.

New Weekend Project - A website that teaches the console by leading you to modify the website via the console.
If you think about it, it's imitating how a lot of us auto-didacts learnt to code, especially in the 2000s.

Got some script for modifying a game or an excel function or some code that doesn't quite do what we want it to. Bash it with random changes until you suddenly fix/change/etc. it.

Get a bit addicted, rinse, repeat, suddenly a month later you can understand most of the code.

Can verify pulling apart the Southwest Airlines website back in the day with my HTML book on my lap was quite edifying.
>Instead, when I give kids a great big block of javascript code that does something fun and animated, those kids will go wild with it.

It's too bad elementary and secondary education in general aren't more like this.

The "hack Google" through web inspector reminds me of an experience I had a while back.

The plan was to teach kids about how websites works/HTTP basics, basic HTML/JS etc. I had all the material and code ready. When I reached the school I found out their internet had been disconnected!

Google's "browser is offline" T-Rex game popped up and I ended up spending the entire week with them teaching them how that game worked. It was a big hit! By the end of the week they were busy modifying the t-rex sprites with each others faces and stuff :)

Basically have a back up plan for no/limited internet!

I spent some time volunteering at an event where we were paired up with a ~5-6 year old, working with Scratch.

We had a lesson plan booklet to work from, but I found it far more effective to completely ignore it and let the child explore, and then guide the result of that exploration into a result. Seeing the sheer delight on a kid's face when you point out that with a few minor modifications, what he or she has made is in fact a playable computer game is spectacular. (and then beatboxing with them to record "background music" and sound effects is also fun ;) )

This mimics my experience. I have ran summer coding workshops for 8 to 14 year olds and am currently teaching a coding elective to 11 to 14 year old kids at a local charter school. Each lessons starts off with a semi-completed program and guides them into how to change & modify that.

I have learned not to bore them with business apps or too much of the logistics to start. I start by getting them to code basic HTML/CSS. They get super excited by learning how to change colors and font sizes. Then we go into programming some simple JavaScript games. Later in the course, I bring in a Raspberry Pi and introduce them to that and a little Python.

You don't want to scare them away or overwhelm them at first. Keep it exciting and fun. At this age, let them hack.

Glad someone beat me to it.

Teaching kids to code is similar to teaching just about anything else: get them to have fun and find how it applies to them, followed by how to figure out what they don't know, then how to keep going when things are frustrating and they want to give up.

More practically, the kids who are into games have probably already figured out how to write Minecraft mods or something, so introing them to something like Code Combat is a fairly natural next step. For kids into music, try http://sonic-pi.net. Sports? Maybe wade into statistics/data analysis and show em some moneyball or fantasy football. Lego Mindstorms-style stuff is awesome for just about everyone because of the tactile aspect, and moving from that to playing with simple electronics can be done with gentle happy path introductions.

Also be aware of where the falloffs will be. Lots of kids can change the color on a prebuilt object on Khan Academy, but going from changing a field to starting from scratch on a new idea is an incredible. Teaching debugging and figuring out how to solve something you haven't seen before is more important than anything else.

Hack Google works for all my peers in high school. Or with the gradebook. Then I hit f5 and watch their smile fade away when they realize the 178%they just gave themselves in math won't stay
"Give them simple partially completed programs that they can modify. ... Do NOT lecture to them or try to do long demos."

YES. I wish I could upvote this more. Curiosity is a powerful drive for learning, and when kids are allowed to pursue their own line of questioning and tinkering, the questions asked are more "personal" and the information learned IMO is more likely to be retained.

The "zero-entry pool" that Scratch provides is also important (how many kids want to spend a lot of time setting up their development environment?), but I think the tinkering is key. Kids who are simply content to tinker with what is provided will stay at that level; the ones who are truly interested in going beyond that stage will begin asking questions and driving beyond what has been provided.

> I've had a lot of success with a simple trivia game that lets them start by modifying the questions/answers & the replies it gives.

The beginning of my own path to being a programmer, long ago, was playing with games made in RPG Maker 95. If I didn't understand how to pass an obstacle, I would "cheat" by opening the game's world-database file up in the game editor, finding the "object" with the logic that was inhibiting my progress, and then modifying it to allow me to bypass it.

After that, I progressed to just opening games in the editor to "figure out what the author actually wanted me to do here" so I could go back to the game and do it; and then, finally, just observing how people had constructed their games.

All in all, it felt very natural to transition from there, to making my own games in the editor.

I think it was a (probably unintentional) brilliance on the part of the company who produced the software, that the games produced only by using the "hardcoded" features of the game-editor were so simplistic and limited--while also allowing a complete, Turing-complete scripting capability. It meant that, very quickly after starting down a path saying "I want to make a game", I was forcing myself to learn programming concepts in order to extend the engine with the features I wanted in a game.

After a while of doing that, I had absorbed enough about programming to understand that the game-editor tool itself wasn't "magical", and that the whole of its hardcoded game engine could be represented with a not-overwhelmingly-large piece of the same scripting-language logic I had already been writing.

After that moment, it just felt "natural" to move on to reading some Javascript tutorials online, and to pick up a book on C.

The realization that there was no magic in the software I interacted with, but instead merely sequences of small, logical steps I could identify and replicate myself, using a library of atomic mechanisms (branches, loops, etc.) specified to a computer in a formal language: I think that is the one thing that needs to be captured by anything that claims to "teach programming."

And, personally, if I were going to teach programming, I'd try to do it just as I did above: give them completed game, but an overly-difficult one, one which they aren't just modifying for the sake of modifying, but modifying because that's what will let them win.

And, at first, I don't think "programming" even needs to be introduced. Just introduce the framework, the idea of modifying an existing interactive thing (don't call it a program), even if it's just by opening a visual editor and erasing a rock that's in your way.

Then, in later exercises, you can make the "thing that's in your way" much less simple--a sprite whose state is wrong, an event that won't trigger until a flag is set from somewhere else, a person who expects some variable to hold an impossible value where you have to construct the trigger to set that variable yourself; etc.

Eventually (but probably within one semester of an after-school-club setup!), this "adversarial modification framework" could work up to the point of something like Core Wars, where the student is writing writing complex agentive processes controlling shield drones to protect the player-character from enemy fire as they move toward a goal.

From there, you've got a decent jumping-off-point to the "wanting to mod the engine to get it to do the cool things other people have made it do" phase, and from there to the "why not just write it all myself?" phase.

My first programming experience was a course for about ~10 kids between 8 and 12, where they showed us to program Lego Mindstorm roboters with NQC. http://bricxcc.sourceforge.net/nqc/

Some other thing could be Scratch/Kara, but I'm not sure if it exists in english and personally I don't like it.

A nephew of mine (~9) got a Kano for Christmas and the setup and all the gamified coding exercises were really fun. He really enjoyed them.

Perhaps something to explore as a platform as well as it's not too expensive and comes with what you need to hack around.

It comes with Minecraft Py installed and has a few tasks to customize a level, character, etc. Python dev tools comes installed as well as Scratch and other exercises.

The idea of gamifying tasks across the platform is interesting especially if you think of a class of folks and a leaderboard or something - maybe not something to stress but some folks like competition more than others to drive them to learn.

https://kano.me/store/us/products/kano-complete

I highly recommend Kanos. I backed them on kickstarter and got Kanos for each of my kids. They all got them assembled and running and started working through the programming exercises with them. For some it inspired other follow on programming explorations.

Lately I've reset the learning process focusing more on basics (networking, files, processes, utilities, etc) rather than programming.

Do not teach them how to write code. Teach them computational thought. There is a huge difference in approach, and in results.

I've been working indirectly with school districts doing this for a couple years now, and have seen great results from curriculum very similar to this -- https://code.org/educate/curriculum/elementary-school#overvi...

There are other courses for different ages, too. Not sure what age groups you are looking at...

Once they know computational thought, THEN teach them how to code for an app.

I've done a little of this with 9-12 year olds. The most important thing is quick feedback and keeping it simple. They absolutely loved making websites. I taught them enough HTML to get started and set them up with a editor and preview window. I wrote a little web app for this, so that they were editing a "live" site they could show their parents when they went home (or keep working on it, on another computer). It was super simple and just had the functions they needed. Also, as someone else suggested, using the inspector tool to mess around with existing websites was really fun for them.

Another project was using arduinos -- and I even got them writing C, which more or less worked. You didn't need too much code to blink a light and they loved that. The mix of coding and the hands-on wiring up their breadboards kept it engaging. We did a little project where the light blinked with a frequency related to a temperature sensor, so when you put your finger on it, it would blink faster. One kid had the grand idea of having it blink faster when cooler and slower when warmer, and watching him figure out the math was great.

Take a look at code.org, its a resource for teaching coding. I haven't used yet but was interested in https://code.org/minecraft for teaching kids.
It depends on the kids' age. Older kids could probably handle Python though setting up + computer availability might an obstacle. If they have access to shared computers maybe javascript could be good since they can test things out in the browser.

For younger kids maybe a block-programming interface would be good: https://developers.google.com/blockly/ || https://snap.berkeley.edu/ || https://scratch.mit.edu/

For a less high-tech approach, you should look at http://csunplugged.org/ , e.g., http://csunplugged.org/binary-numbers/

In all cases I think the instruction/teaching is going to be key—through the physical presence and support. It will be comparatively more difficult to bootstrap and get them to learn by themselves. Peer tutoring is very promising though: See: https://www.youtube.com/watch?v=dk60sYrU2RU and https://www.youtube.com/watch?v=y3jYVe1RGaU

It would be great if you write a blog post about this and what worked so people can follow in your footsteps. Good luck!

+1 for block-programming, even for older kids/teenagers. I taught a high school CS class using Snap.

At first, I thought it was silly to teach "drag & drop" programming and would have preferred a high-level scripting language. But, after teaching 2 semesters of Snap and observing classes in Java, I'm a huge fan.

2 main reasons:

1. Time-to-cool-result is really low. The first project was a Mario-like game. Less than 10 hours from "never programmed" to "built Mario game" is a really powerful first experience. (Demo: http://snap.berkeley.edu/snapsource/snap.html#present:Userna...)

2. Syntax and compiler errors are really confusing. When I walked around the Java class, most kids were asking questions about how to fix their syntax errors. In my class, most of the questions were conceptual.

It's easier to go back and learn a "real" language after you understand the high-level concepts and have seen how cool programming is.

If you want the resources I used, feel free to ping me (adamaflynn@gmail.com).

The most important thing is getting them to have fun, and have a positive association with coding. I use to help out with a CoderDojo, teaching kids of all ages, and the best thing to do was get them to have fun. Kids that actually enjoy the content they are learning, will learn much better.
Consider Bootstrap:

http://www.bootstrapworld.org/

Bootstrap 1 is computing tied to algebra concepts, targeted at the middle school age group (US grade 6-8). Students learn things like order of operations and what a function is while building up their own game. The curriculum has lots of activities that show students how to use code to generate images early on, which gives something immediately interesting and tangible to work with.

It runs in a stock browser (lots of students do Bootstrap on inexpensive Chromebook models), has a great support mailing list, and is used in schools across the US already. It also explicitly helps with math skills, which can be doubly useful in preparing for other STEM topics in the future.

It depends a little bit on the age of the children. One important thing to consider is that the sooner they can see visuals that are produced by their code, the more they will be able to understand the cause/effect of programming. I've taught groups of middle schoolers to code with Processing and they've far exceeded my expectations. Daniel Shiffman's resources (http://natureofcode.com/ and his YouTube series) are great.

You can also get things up and running really quickly with LOVE2d and Lua. love2d.org

I used to help teach kids (12-16ish) how to code.

One thing that we always did towards the beginning of a class was an exercise where we tell them to write down the steps to make a peanut butter and jelly sandwich. Then we'd literally get bread, peanut butter, and jelly, and follow their instructions to the letter. No one ever adequately describes the process: "put peanut butter on bread" - With what? the jar is closed, I can't! etc.

You might argue this introduces too imperative a thought process - but it gets the "computers do exactly what you tell them to" idea across very well.

>No one ever adequately describes the process: "put peanut butter on bread"

Sounds like the perfect introduction to abstraction and wishful-thinking guided programming! (Maybe not using big words like abstraction for kids)

I think this is much more relevant to both coding, and applicable to other disciplines as well. I do very little coding, I don't find it interesting, it's not at all the same basic knowledge base as history, civics, math, science. Coding is a higher level that requires a base first. I'm not skeptical of introducing code at such a young age, but I'm skeptical of treating it as if it's a basic thing many/most/all kids should understand.
I had a music teacher do exactly this to a class when I was 10 or so, and it's one of the most memorable school experiences for me as a child. The purpose was something like explaining yourself well, rather than programming, but the idea is the same.

We needed to describe how to draw some sheet music on the chalkboard, but you couldn't gesture (we could only communicate through an imaginary phone line), and he would take whatever you said as literally as possible and opposite of your original intention as he could.

"Ok, draw 5 lines" (Draws 5 squiggles) "No! 5 straight lines" (draws 5 lines in various locations and directions) "Nooo! 5 straight lines, above each other, horizontal!" (Draws the 5 lines of a musical staff, but 2 inches long and 3 feet vertical spacing between each line). "Nooooo! 5 straight lines, above each other, horizontal, they should be very long and close together" (Takes out a piece of paper from his desk, draws the staff on it) "NOOOO! On the chalkboard!" etc

CS Unplugged (http://csunplugged.org/) has some good resources for teaching CS concepts without needing a computer. I'm not sure how easy they would be to do at a distance, but you might find some aspects that would work well.

Bootstrap World (http://www.bootstrapworld.org/) is a curriculum for teaching CS and Algebra while making a simple graphical video game using Racket (similar to Scheme). You can do the exercises using Dr. Racket IDE or by using a web-based IDE (http://www.wescheme.org/).

You also might take a look at Picturing Programs (http://picturingprograms.com/) and How to Design Programs (http://www.htdp.org/). Both of those may be more advanced than what you would want to start with, but they are both focused on teaching computer science concepts more than the particular language and both are aimed at beginners without any background with code.

Hello!

We run an after school classes program in Barcelona, Spain. Where we teach kids from age 4-15 "programming" or computational thinking.

Depending on age group there are different tools, and starting with the really young ones, we use tools like Hopscotch and other simpler coding apps, when we use technology. And even more fun is to learn about coding not even using any tech. So then we revert to using pen/paper/strings and ourselves, programming each other is a fun thing to do, and you can debug the code in group, and learn to understand how computer operates, and how to give orders.

Once the kids get slightly older, we use to go straight to scratch, (this is the first stop we tend to go to regardless of age if anyone is new, just to grasp concepts) This will not take to long if the kids are older than 10.

But even from 6 years of age we've seen enormous potential in using scratch, kids love it, it's visual in the output, super versatile in what you can do (we get blown away by the kids all the time). And you can indeed build very complex things with scratch, as well as you can produce a pong game in matter of minutes.

Main take away, if you want the kids engaged, get them super comfortable in Scratch, and get them to understand problem solving using computational thinking, rather than go straight to the browser and manipulate the DOM, that's not learning kids how to code, thats like peeking and changing values, not really getting to the core of programming.

Once the kids are comfortable in understanding that one thing can be solved in more than 10 ways, and that no real way is the right way (except if it is). Than make an introduction to text based programming, either looking inside scratch code, or by looking at something in the visual spectrum, like processing, this is a great first step and good jump from scratch. And it's easy to build on top of this and move into javascript.

When I'm mentioning age groups it's only if they have zero prior knowledge about coding, we have 6 years old that program as good as 12 years old but the 6 year old kids have been doing it for a year or more and the 12 year olds are just a couple of weeks into classes.

So it's also about checking the temperature on knowledge. Once you start moving up the ladder on text based programming, it's important to understand how to keep the vast majority interested, and not just the .consoleLog(); persons interested. Keep in mind that programming comes in many shades, and not everyone is hard core math nerd loving, but still can be terrific problem solvers, if given the right tools to do so.

I would say the biggest take-away for us since starting KidsHackClub.com is that make sure it's fun, do not indulge in long demos, or make complex things, and show of big projects, it wont get the kids into coding, it will scare them away. So start small, and build up as time goes, and make things that are visual, no-one enjoys staring at lines of intigers counting in the console, sorry peps, it's kids from the touch generation, they have played with phones and tablets since they where born.

Would love to chat more, just hit me up on twitter @LinusEkenstam or @KidsHackClub and we can also do email, but ping me on Twitter and we can hook up.

and yes, obviously when they grasp the concepts, we move on to do robotics, lego, 3D printing, painting robots and so on, but getting the basics is the first step, then it's just like a waterfall. :-)