The best kittens, technology, and video games blog in the world.

Thursday, September 01, 2016

How to teach coding

Book cat by raider of gin from flickr (CC-BY)

I've been helping people learn coding for a while now. Here are some notes.

Free resources

  • there's a lot of free resources out there
  • nearly all of them are of poor quality
  • it's very difficult to make good resources for make resources for someone very different than you - and by the time you can write a tutorial you're long past beginner phase
  • very often resources spend far too much time on pointless distractions, have huge difficulty spikes, present material in order where current lesson depends on something that will only be explained in the future etc. It's clear they're not adequately tested on actual beginners.

How to learn coding

There's absolutely no reason for anyone to ever do anything else than:
  • stay in-browser as much as possible
  • learn basics of HTML and CSS
  • learn basics of jQuery
  • only then progress to anything else
As far as I can tell that's the only way beginners can actually create something interesting and useful.

If you start by teaching people ruby or python, the best they can do is some completely artificial terminal programs like guess-a-number or such.

Even if someone needs to learn ruby/python, the best way is to first teach them web technologies, and then thanks to some framework like Ruby on Rails they can build something useful.

I'd very strongly recommend against teaching people "Javascript" as such. What people need is just bare minimum to be able to do simple jQuery style manipulations. Non-jQuery Javascript is better left for far later.


A lot of resources try to teach beginners how to use terminals, text editors like Atom, git, github etc. before they get to any coding. Crazy ones even try things like vim.

It's mindboggling why anybody would consider it appropriate to start with this. It's a massive distraction from the goal of learning programming and writing useful programs.

Fortunately there's a powerful environment even absolute beginners are comfortable with, and that's the browser.
  • - run simple program and repls in almost every programming language
  • - experiment with HTML/CSS/Javascript and related technologies
  • most online courses have in-browser editors and tests
It's useful for every beginner to have a github account and to download Atom, but these shouldn't be the focus.

For people who use OSX, going off-browser is tolerable, but for people with Windows laptops that's huge amount of pain, so it's especially important to stay in-browser as much as possible.

Free resources reviews for web development

They're fairly good, and you can do a lot in-browser:
  • freecodecamp - this is the best beginner resource for web technologies I found - it covers a lot of content, it's well structured, and contains low amount of nonsense; there's a bunch of stuff that's "coming soon"
  • codecademy - it has a lot of content (web and non-web), but a lot of it has serious issues like random difficulty spikes and chapters with poor explanations
  • codebar tutorials - they're OK, but they suffer from having to download files and do everything locally - I found that in-browser lets beginners focus on the subject much better and be less confused by tooling
It's important that beginners can use minimum of unfamiliar tools for it, and mostly stay in-browser.

It's also great that hosting on offers free and very easy to setup hosting for such apps.

Free resources for non-web development

I'm much less happy with these resources compared with web development resources:
  • ruby in 100 minutes - it seems to take people about twice as much. Whenever anyone wants to do it, I generally tell them to go chapters 2, 3, 5, 7, 8, 6, 9, 1 0, 11 and use
  • Learn Ruby the Hard Way - I don't like this book, as it teaches Ruby as if it was Python, which feels like it completely misses the point.
  • codewars - good practice for intermediate level if you set the filters correctly (8kyu only, unsolved only, sort by popularity), as the defaults are completely wrong for beginners. It's much more useful for people who can already program and simply want practice in new language.
  • try ruby - a nice in-browser introduction. It suffers from minor distractions like symbols (I wish ruby just killed them completely) and ruby 1.9 leftovers.
  • udacity - I've been generally rather unhappy with quality of that, and they completely ignore all reported errors
  • books - just not worth it for beginners - in-browser environment and immediate feedback are just far superior
  • everything that you need to download to solve like rubykatas, exercism etc. - they're ok, but best left for later
It's much harder to setup hosting for your ruby/python programs, and it usually costs money.

Free resources for tools

Tools I'd recommend teaching:
  • stay in browser as much as possible - that's what everybody already knows
  • browser's development tools - this is generally fairly straightforward progression from basic browser skills everybody already has
  • - far easier to get started than creating a bunch of files and keeping them synchronized etc.
  • - this should be deafult repl, not any kind of in-terminal irb/ipython/etc.
  • Atom - from what I've seen beginners have little trouble with it, unlike with some complex editors. It has ton of plugins, works on everything, and it's perfectly adequate for serious programming as well.
  • github - the browser side of it is reasonably approachable, terminal side much less so, and I'm not sure if there are any good client-side programs to make it easier.
  • hosting - to keep people's motivations
  • terminal basics - it's fairly painful, and I wish Atom did more of it, so terminal would be needed less.
  • git basics - it really pains me, as this is extremely unfriendly towards beginners, but there's no alternative, and at some point they'll need to learn it - at least there's immediate payoff in github and
Unfortunately I haven't found great tutorials for any of the tools.


Noumenon said...

What kind of teaching do you do? What kind of students? Looks like you're interested in raising strong coders, not career switchers and teenagers. I'm interested in teaching kids, but I suppose adults have a better chance to learn.

I taught myself to code over the last 2-3 years and am three weeks into my first job as a Java developer. I used pretty much none of this stuff, but seems pretty awesome! I agree that being able to create a user interface with <img> and <form> tags is pretty sweet. I used TortoiseHG because it's so much easier than Git, and even though I came around and learned Git in the end I'm not sure I'd start there.

This post would be more appealing to me if it had some notions of what the learner is working toward. Like if I use all these sites, will I be able to build a CRUD app? If I want to build a social network, do I need to learn Atom? How does improve on just putting something on Heroku?

I took a more topic-centered approach to learning. I need to learn version control. I need to learn how to write unit tests. I need to learn design patterns. I need to learn about prototypes. Getting up and running in the browser is nice, but the only time it was make-or-break for me was around the 1-month mark, trying to get an Apache server running so I could practice PHP. I bet I would have made a lot of web apps if I'd ever tried any of these easy services you're talking about, but making a web app is only one topic area.

I still have very little idea what Ruby is or what it's good for. Vaguely like Android for web apps? I'd start a rank beginner out on Scratch, the easiest and most responsive environment of all. And I'd give them Python because you can just do stuff with it.

taw said...

Noumenon: Mostly at codebar. Typical profile is a young adult with limited tech skills (like up to maybe basic html or sql plus having some half-remembered classes of python or whatever at schools; often not even that), who wants to learn some coding to maybe try to get a junior tech job. The key challenge is getting them comfortable with coding and not completely lost in so many tools, technologies, and obscure terminology - at certain point they reach level where they can learn on their own, but it takes considerable time and considerable guidance to get there. Hopefully once they get foot in the door, they can continue their development there with help of more experienced teammates.

Opening a codepen and starting coding there takes seconds. Going from zero to putting something on heroku takes days. Pretty much none of those people are comfortable with terminals, git etc. so it would be black magic to them, and possibly discouraging rather than helpful.

Ruby is good for Ruby on Rails, which is by far the most popular web framework, and it's also good first language to learn. Python suffers from lack of similarly approachable web framework.

I can't say I have any hard evidence that my approach is best, these are just some notes.

Noumenon said...

Codebar looks awesome! I am totally looking for an opportunity to volunteer to teach coding -- if TEALS expands to Maryland I will be teaching kids in the mornings for sure.

Codepen looks fun for HTML but the lack of a run button confuses me. I'm too used to JSFiddle. I wish JSFiddle had its own console like that.

I don't doubt your approach is far better than the academic 'let's draw flowcharts about loops" teaching method they'd otherwise get.

taw said...

Noumenon: codepen by default has "Auto-Updating Preview: If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update."

I'm sure there's other similar sites, I just listed ones I use.