How to Teach Programming (and Other Things)

Please comment on the plan for the next edition.


In Brief

This book shows readers how to build and deliver high-quality learning experiences to people who want to learn how to program (and other things as well). It is based on Software Carpentry’s instructor training course, and all material can be freely distributed and re-used under the Creative Commons - Attribution license. Please see for the source, for the online version, or buy a printed copy. PDF, EPUB, and MOBI versions are also available.

Thousands of grassroots “learn to code” groups have sprung up in the past few years. They exist so that people don’t have to figure out how to program on their own, but ironically, that’s exactly what most of their founders are doing when it comes to teaching.

As many have discovered, there’s more to teaching than talking. Good teachers break subjects up into digestible pieces, design lessons with verifiable goals in mind, check their students’ progress at short intervals, and encourage collaboration and improvisation. Like good programming practices, these don’t have to be reinvented by every teacher: they can and should be taught and learned. And while these practices won’t magically make someone a great teacher, they do make most people better teachers.

This book is a brief introduction to modern evidence-based teaching practices and how to use them to teach programming to free-range learners. It covers:

  • how people’s thinking changes as they go from being novices to competent practitioners and then to being experts;

  • how to tell if your learners are keeping up with you, and what to do or say when they’re not;

  • how to design and improve lessons efficiently and collaboratively;

  • how and why live coding (i.e., writing programs step by step in front of learners) is a better way to teach programming than lectures or self-directed practice; and

  • how insights and techniques borrowed from the performing arts can make you a better teacher.


I started teaching people how to program in the late 1980s. At first, I went too fast, used too much jargon, and had little idea of how much my learners actually understood. I got better over time, but still had no idea how effective I was compared to other teachers.

In 2010, I rebooted a project called Software Carpentry, whose aim is to teach basic computing skills to researchers. In the years that followed, I discovered resources like Mark Guzdial’s blog [Guzdial2017] and the book How Learning Works [Ambrose2010]. These led me to [Lemov2014], [Huston2009], [Green2014], and other sources that showed me how to make my teaching better and why I should believe it would work.

We started using these ideas in Software Carpentry in 2012, and the results were everything we’d hoped for. We also started offering a short course to introduce people to these techniques and the ideas behind them. This course was originally delivered online over multiple weeks, but by 2014 we were teaching it in two intensive days (just like our regular software skills workshops). Since then, I have run the course more than forty times for people who want to teach programming to children, recent immigrants, women re-entering the workforce, and a wide variety of other groups. Those experiences are the basis of this book.

Who You Are

Learner Personas will explain how to define who a class is for. Here, we present personas of two typical participants in a workshop based on this book.

Samira is an undergraduate student in mechanical engineering who first encountered the subject in an after-school club for girls and would now like to pass on her love for it. She has done one programming class and one robotics class, and was a lab assistant for a couple of weekend introductions to engineering for high school students at her university. Feels insecure about standing up and teaching a subject that she isn’t an expert in (“I’m not a professor!”).

Samira would like to learn techniques for explaining ideas and handling unexpected questions or situations. This workshop will introduce her to some basic classroom practices and give her a chance to try them out in front of a supportive audience.

Moshe is a professional programmer with two young children. Their school doesn’t offer a programming class, so he has volunteered to put one together. He has been programming in Visual Basic and C# for almost twenty years, during which time he has frequently given presentations to colleagues and management, but after reading a dozen different “programming for kids” books, he feels more confused than ever about what to do.

Moshe wants to learn how to build lessons that both he and other people can use and maintain. This class will show him how to design and deliver lessons tailored for his students, how to tell how well those lessons are working, and how to keep those lessons up to date.

Moshe is partially deaf, and most of his students have hearing disabilities as well.

Teaching Practices

We suggest that instructor training workshops use these three teaching practices right from the start:


This book is the product of many contributors, including Erin Becker, Neil Brown, Francis Castro, Warren Code, Karen Cranston, Katie Cunningham, Neal Davis, Mark Degani, Brian Dillingham, Bob Freeman, Mark Guzdial, Rayna Harris, Ian Hawke, Kate Hertweck, Toby Hodges, Christina Koch, Colleen Lewis, Sue McClatchy, Lex Nederbragt, Jeramia Ory, Elizabeth Patitsas, Aleksandra Pawlik, Emily Porta, Alex Pounds, Danielle Quinn, Erin Robinson, Ariel Rokem, Pat Schloss, Malvika Sharan, Tracy Teal, Richard Tomsett, Matt Turk, Fiona Tweedie, Allegra Via, Anelda van der Walt, Stéfan van der Walt, Belinda Weaver, Hadley Wickham, Jason Williams, and Andromeda Yelton. I am grateful to them, and to everyone who has gone through classes based on this material over the years.

This book is dedicated to my mother, Doris Wilson, who taught hundreds of children to read and to believe in themselves.


Favorite Class (10 minutes)

In the online notes, write down your name, the best class you ever took, and what made it so great.