Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How would you teach a middle / high schooler how to code?
11 points by NeilRShah on Feb 2, 2013 | hide | past | favorite | 13 comments
Obviously there are many sites out there on "teach yourself how to code" and books on "learn to code in 30 days." I have a little bit of a different take on the subject, and would love to get your opinion.

If you were teaching a 14 year old the most important thing to expose them to the world of programming, what would it be? Let's say you have 1-2 hours a week and a year to do it.



I have been teaching my 13-year old sister how to code over Skype, and built this tool to help: http://replpad.com

It's a collaborative code editor that will run the code in-browser, so we can write together and run the code all on the same screen. We've been working through simple problems and I've been teaching her how to solve her math homework programmatically.


I think an interesting way to talk about programming that may be quiet successful for people who are younger is to try and strip away the sytax of language, and instead focus on the semantics. It would allow a person to develop a deep understanding of core concepts such as different data structures and algorithms without being bogged down in the minutiae. Once I think there is a solid foundation in the general concepts I think it would be much easier to transition from language to language since they already understand the semantics of what they are trying to do and simply have to focus on the sytax to accomplish it.

Now this has the potential to lead to disintrest since they wouldn't have the ability to create something and receive the instant feedback of their hard work. But I do feel like it may be an easier way to lead them into it without throwing them into the deep end of language specific syntax which i would imaging feels pretty dense and impenetrable to a lot of people starting out.

As well it would be pretty easy to create word problems or games that would help them develop the general understanding. Something like the following problem:

There is a 100 story building and you have two identical eggs. You need to figure out the highest floor that you can drop one of these eggs from without it breaking. Once an egg has broken you can never use it again. How would you go about figuring this out using the fewest possible drops possible? What if the building was 1,000,000 floors tall?


You need something based on intrinsic motivation.

A lot of people saying "start with teaching problem solving and algorithmic thinking" and while I agree that this might be "the best" way to learn how to do programming from some angles it is probably not especially motivating apart from to people who are intrinsically interested in math/logic puzzle type things.

It probably works as an approach in a CS programme where you have the luxury of saying "do this or you don't get a degree" and where you are trying to weed out people who might not hack it in the long run. It may also be more time efficient in developing actual programming skill, but that is not necessarily the point here.

A good example is to look at minecraft modding tutorials on youtube. Based on the commentary it's clear that some of these people don't really understand Java and don't really know what they are doing and are mainly learning by copying others. However they are still getting the results that they want to some degree so they keep going.

At some point these people will inevitably hit against hurdles because of their approach. At this point they may either give up in favour of some other hobby or they will naturally gravitate towards reading the accumulated wisdom about debugging techniques, OO design etc.

I can see why the more formal approach is appealing to people who started as being self taught and are introspecting about their own development as a programmer.

There's certainly plenty of times where I think about older programs I had written and thought "if only I had read textbook X first, that would have been much easier/better".


The same way you'd teach anyone else, as there isn't any advanced Math or vocabulary necessary.

Does the teenager have a knack for it already? I could've been coding before I was 10 years old and it would have been no more difficult for me to learn.

Making it a (fun) game is a good idea. Or you could have them come up with something they've been wanting to do, then use the process of creating that solution to introduce them to the concepts behind programming, and to how to apply them. Just have them work out how they'd go about creating that thing they mention, then show them how they are essentially programming already, and that the language they are learning is just a different way of expressing what they are already saying.

If they become curious or interested, then they'll spend their own time fighting with the code, and that will allow it all to sink in in a way they'll understand.


I've been teaching my girls how to code for a while now (was even published in Hacker Monthly magazine for it). My experience has taught me that the only reason they will learn to code is:

    If they have something they want to build themselves.
I battled with this idea for a while. Why can't they just build a website and be done with it? Turns out, building websites is boring if you don't want a website.

I tried all sorts of languages and tools. What has worked for me has been using the Arduino platform to build animatronic projects for Halloween (a pumpkin that yelled and flash LEDs), and Minecraft. With Minecraft you can create your own textures and game objects by using Java. Its really fun, and they can see the connection between code and results very quickly. Try it out.


I'm sorry but there is very little you can teach them about programming that will stick with 1-2 hours a week of effort. Assuming the kids aren't self-selected (unusually bright, inherent interest in programming), you are very limited in what details you can expect them to remember from week to week. You're better off giving them a few hands-on tasks that are graphical and mostly self contained. Building a simple 2D game in stages over the year can work. Building a world with rules like gravity and momentum, and then building a simple collision detector might be the highlight of the course.


I'd concentrate first on building internally consistent mental models.

A Lisp repl, I think, would be a fantastic tool for this -- and I suspect "Common Lisp, An Interactive Approach" might be the perfect text for homework.


> I'd concentrate first on building internally consistent mental models.

I strongly agree -- and the Lisp/REPL combination is extremely helpful. Specifically, I believe a Scheme-based approach is the best way to learn programming, even if you eventually decide to migrate to something less fortunate like Javascript or Python ... in under an hour from your first exposure you can be thinking about stuff rather than the syntax of loops. I won't attempt to justify the pedagogical reasons for this choice here.

Specifically, I'd recommend (1) using Racket, a "batteries-included" Scheme derivative with a simple IDE/debugger, and either (2) Concrete Abstractions (free at https://gustavus.edu/+max/concrete-abstractions-annotated-to...), or (3) the upcoming book Realm of Racket (coming in May), which will cover some of the same CS 101 material as well as GUI and distributed programming via writing games in Racket. (There is an earlier book called Land of Lisp but I feel its environment (CLISP) and coding practices are rather baroque.)

Depending on your student's interests you could simultaneously look at some web programming (plenty of HTML/CSS material is available from Mozilla, Google, etc.; there's an upcoming Udacity course on HTML5 game programming), lower-level stuff like assembly, arduino, or whatever.

Hope this helps.


The khan academy has some really really good intro to CS videos for free. It is primarily python and JavaScript along with basics of algorithms and data structures. Show the kids that they get badges for learning and can compete for more points. I couldn't recommend it enough

www.khanacademy.org/cs/tutorials/programming-basics


I would try teaching him/her to make a simple website first. That way they can see that with a little effort, you can make something really neat on the computer.

CoronaSDK is also a good choice. Then there's all those sites like codecademy which would be helpful as well.


Out of my previous experience teaching a kid, I would say introduce him to algorithms and problem solving techniques. Then, once he gets the good hold on it. You can pick javascript for a good start. And this is my opinion.


Codeacademy.com it is free and contains lessons on html,css,javascript,ruby,python,jquery, and apis. Plus if he really gets into it you can always sign him up for codeschool or team treehouse later.


Want to try and teach me? I'm 15 and eager to learn.

(Not expecting anything when posting this)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: