PyGotham 2016 - "Young Coders (or, 'How To Teach Python To Kids')"

Jul 16, 2016 PyKids Python

(Note: These are the slides and speaker notes from my 2016 PyGotham talk, "Young Coders (or, 'How To Teach Python To Kids')".)

This talk is for any Python programmer who's interested in passing their knowledge on to younger students. And I really do mean any Python programmer. Teaching experience is nice to have but it’s not required.

If you're here, you probably already have some idea why you should teach. Coding is today's literacy, and too many students are still not being exposed to it in school. As Python developers, we have a unique opportunity to share our skills in our local communities and give kids an experience that could make a huge impact on their lives.

Do you remember that sense of wonder you felt the first time you realized what you could do with code? You could help someone else discover that same sense of excitement, and start them down the path towards a lifetime of exploration.

And organizing a class could change your life. It's a great way to introduce yourself to interacting with young students and will help you get started in teaching and public speaking.

I’m going to talk a little bit about the 'what' - the things you need to set up a class, like hardware, venues, and probably the most important thing: financing.

But where I want to spend the most time is in telling you how, and convincing you that teaching kids is easier than you think. All you really need are the desire and a little Python experience.

Why should you listen to me?

I’ve been involved in the Python community for about a decade now, but I actually began my professional life as a school teacher. I was only at it for a few years before I realized that I could never move out of my parents’ house on that salary, so I made a change. tl;dr I’ve been a successful developer for a little over 15 years now. But I didn't know how much I missed working with kids until I got the chance to come back to it.

In 2013, PyCon organizers came up with this idea for a new program called Young Coders. So that year, I flew into San Jose with this curriculum that I had pieced together at the last minute. And along with Katie Cunningham and a team of enthusiastic volunteers, we taught our first one-day intro to Python for young students.

Since then I've been lucky enough to teach both kids and adults through organizations like PyLadies and DjangoGirls. Teaching has become a dual passion for me, alongside programming.

Also in the years since, Python classes for kids have sprung up all over - at regional conferences and in after-school clubs.

And Young Coders at PyCon has continued to grow every year. For the two years that PyCon was in Montreal, we had the curriculum translated into French, and a couple of developers from the community up there taught it to local school kids. Then a few months ago in Portland, we introduced a new intermediate class to go along with the original beginner class, and that was a huge success. Kids did their first real scripting, worked with APIs, built their first web sites - it was so exciting.

As glad as I am for my teaching background, it's my programming background that's made all of this possible. Any of you out there could do it just as well, you just need a few pointers to get started.

I want to keep that momentum going. I want to keep Young Coders growing beyond just a couple of classes at conferences every year. And I want to do that by convincing all of you to organize and teach classes in your own communities.

So what do you need to organize a class? (To be clear, I’m talking about a one-day workshop, so a short-term learning experience, not the long-term experience you would expect from a public school classroom.)

I’m just going to skim over this list, but at the end I'll be giving you an online resource that has very complete descriptions of each of these things.

  • classroom space
  • sponsors (hint: the PSF is great about financing classes like this!)
  • teaching assistants to help out during the class - find them through your local meetup group
  • some way to manage signups - Eventbrite, Meetup, Google forms
  • workstations, and we’ll talk about that in a minute
  • books are a nice-to-have
  • if you’re going to have the kids in a classroom all day, you have to feed them

How you decide to set up your classroom is going to depend on a lot of different factors.

But the one thing I want to recommend strongly is that you use Raspberry Pis, and there are two important reasons why.

One is consistency: It's going to be easier to teach when every student is working in the same environment. You won't have to waste time with installs, or debugging issues that are unique to a particular operating system.

The other is reinforcement: You want your students to have a programming environment that's all theirs, that they can take home, so that they can keep going when they leave your classroom.

There are also some maybe less important reasons - Raspberry Pis (or their operating system) come with a lot of software already installed. There’s Idle - if you’ve never worked with it, Idle is a Python interpreter that has a few extra bells and whistles to make learning easier.

They also come with pygame - in the first few years of Young Coders, we’d have the kids edit constants (things like background colors or player avatar sizes) to see how they affected the games. And newer Raspberry Pis come with mcpi, a library that you can use to interact with Minecraft.

All of this means you’ll be purchasing a lot of Raspberry Pis. But they’re very affordable, and peripherals like keyboards and monitors can be rented for a very low cost. And as I said I'm going to give you some resources to help you figure out financing/sponsorship.

And of course you’re going to want some students.

I would recommend enrolling students 12 and older. The age cutoff is often a point of contention for Young Coders classes. And it’s understandable - parents want to get their kids into coding classes early, and for good reason, but sometimes it can be hard to tell if the kids are ready.

Here’s the thing: Kids develop new cognitive skills as they grow. Even beginner Python requires some abstract thinking, and among childhood development researchers it's generally believed that that ability emerges at around age 12. Sometimes before, sometimes after.

Personally, I think researchers’ views on that are going to begin to change as we see more kids getting into computing at earlier ages. But for now 12 is the usually agreed-upon age at which abstract thought becomes possible.

So you can put an 8- or 10-year-old in a CS classroom and they may be able to mimic what you type, but whether or not they'll comprehend it is not as certain. For those younger kids who are still in their concrete thinking phase, visual learning environments like Scratch and Turtle and Hopscotch are terrific alternatives.

(Note: Earlier in the day, the team from Codester gave a terrific talk titled 'Opening the Magic Box: Creating transitional Python libraries and IDE tools' about developing curriculum for classrooms. They spent a lot of time talking about these stages of childhood development and about what kinds of CS exposure are appropriate for different age groups. They also presented some great ideas for developing your own curriculum if you’re interested in doing that. When the PyGotham videos come out, you'll want to look for that one, but in the meantime the slides are here.)

So where do you find these kids anyway?

You’re going to be tempted to fill your classes with kids who are the children of other programmers you know from your local community.

But I would implore you to consider doing something different. And if you remember nothing else from this talk, remember this part.

You have this unique opportunity to impact kids who might not otherwise get much exposure to computing. Try reaching out to organizations like the Boys & Girls Clubs of America, and Big Brothers/Big Sisters. In Austin we have a group called GirlStart that’s like an after-school/summer camp program for girls who want to focus on STEM skills. Your town probably has something like that too.

So focus on diversity, focus on kids from different economic backgrounds. It might take a bit of Googling and going a little beyond your familiarity to find organizations to work with, but it’ll be worth it - you could really open up new doors for some of your students.

So what soft skills do you need to teach?

You should be comfortable illustrating simple concepts. For example, when we introduce variables in the beginner class, we might describe them as bowls. A bowl can contain all kinds of different things, different values. You can put something in the bowl, then you can take that thing out and put something new in the bowl.

And you don't need to 'dumb down' or be cutesie to talk to kids. Just be clear, keep your explanations simple - they’ll get it.

That said, do keep your examples relevant. The first year we taught Young Coders, as I said I brought in this curriculum that included some materials from an adult beginner class I'd helped with. I had the kids looking at a list of Beatles names - as in, the music group, John, Paul, George and Ringo - and I wanted them to use an index to choose their favorite musician.

I was, of course, greeted by blank stares. A 12-year-old does not know who the Beatles are. Some of you probably don't. So I went back to the hotel room that night and changed that to a list of colors, and that's what we’ve used ever since.

When it comes to teaching materials, you are always free to use the Young Coders curriculum - that's been open sourced since day one. The materials we use at PyCon were originally cobbled together from a lot of different sources, but they've been refined and tried and tested over the years and we know they work.

They’re filled with lots of little ‘a-ha!’ moments, lots of gradual skill-building, lots of little wins along the way to keep the kids engaged.

They're formatted like a presentation - a slide deck with extensive speaker notes that you can use if you find yourself needing a hand when you’re explaining concepts. We project these slides from a computer that also has Idle installed (so that we can alternate between the slides and demonstrating coding tasks).

You’ll find those slides, along with some detailed classroom setup notes, in this GitHub repository. The latest version is in a folder labelled ‘2016’ - that’s been updated for Python 3. As recently as 2015, though, we were still using Python 2, so that’s also available if you’re interested.

Of course if you want to write your own curriculum, there are lots of books and websites to draw inspiration from. Just remember a few things:

  • Make it cumulative - start small, with simple ideas, and build up to gradually more complex skills
  • Make sure it's age-appropriate - and by that I just mean don’t repeat my Beatles mistake, maybe use One Direction, or maybe don’t use any pop culture references at all
  • Keep your variable names short! That’s another lesson I learned the first year - even 12-year-olds aren’t the fastest typists. If you want your students to be able to keep up, don’t use variable names that are 20 characters long.
  • And be judicious about adding game content (and this one may be a bit controversial)

There's a common misconception that kids come to programming classes wanting only to make games.

I've done a little work with my local chapter of CSTA (that’s the Computer Science Teachers Association), and one thing I hear repeatedly is that they can’t get girls from AP math to enroll in the AP computer science classes. The girls think it's only going to be about making games (and they’re usually right), but they want more variety.

It’s also been my experience with the classes I’ve taught - sure, kids want game content, but they’re interested in other things too.

So show them that you can do more with Python than just making games - I promise, once they start talking to their computers with Python, they'll be no less excited.

It’s go time! Day of the class! You’re standing at the front! Now how do you talk to the kids?

It’s not going to be like this, I promise.

Kids are nothing to be afraid of, especially in this context. In fact, getting up in front of a roomful of kids is waaaay easier than speaking to a room full of adults.

And a class like this won't come with some of the same challenges you’d have teaching a primary school class. By age 12, students are already well familiar with basic classroom comportment - they’ll know how to behave and what’s expected of them.

And, too, your students will be there because they WANT to be, not because it’s compulsory. They’re eager to learn this stuff, and they'll soak it all up. I promise.

(By the way, that is a scene from Kindergarten Cop 2, Dolph Lundgren, straight to DVD. Don’t ask me how I know.)

Be collaborative. Don't just read code examples at the students. Interact with them. Ask questions, even if it's just asking them to guess what the results of an expression might be. Engage with them directly. They’ll surprise you with some intelligent questions, and they might even teach you a few things.

They'll be excited to be there, but they can also lose focus quickly if you aren’t mindful of the pace of the class.

  • Leverage teaching assistants to help keep everyone on track
  • Be aware of when students are getting restless. Listen to the noise level in the room - if it’s rising, it’s probably time to move on.
  • Plan frequent rest breaks
  • Set aside some play time for students to explore the skills they're learning. (In recent years, since the mcpi library made its way to the Raspberry Pi, we’ve started spending the last hour of the Young Coders class letting kids write scripts to do crazy things in Minecraft. So they’re practicing the skills they’ve learned all throughout the day, but they also get a chance to be creative. It’s absolutely the most wild, fun part of the class, and it really brings programming to life for them.)

Don't sweat the small details. There's only so much you can teach in a few hours, and the kids will need time beyond the classroom to work with and absorb all these new concepts.

Keep your mind on the big picture: You're teaching kids how to communicate with their computers, and that can be really huge and mind-blowing to someone who's never done any programming before.

Your students are not going to walk away with a thorough knowledge of Python. And that’s fine, that shouldn’t be your goal. What you are doing is planting a seed.

  1. You’re showing kids how possible programming is
  2. And you’re motivating them to want to learn more

This is the site where you’re going to find all that information I mentioned earlier. If you navigate to the 'Teach' section, you’ll find details about all those physical resources, about how to get sponsorship money, where to find the kids, etc.

It’s a new site, just launched a few days ago, but it’s got pages and pages of teaching and organizing resources, along with an online version of the Young Coders curriculum, written in a tutorial format.

I wrote this talk as I was also writing the content for this web site, so if you read it and it all sounds a little familiar, that's why.

None of the site is that pretty - for any of it that looks nice or works well I have to give all the credit to Andrew Dupont, who did all the front end work. I am currently looking for a designer to work with to liven things up a bit. And I’m looking to port the tutorial to an iPython (or now, Jupyter) notebook, so if any of you are interested in collaborating on that, please get in touch with me.

There are going to be lots of additional resources added in the next few months - organizer tools, checklists, some things sort of similar to what DjangoGirls is using to help people organize their classes.

So if you're curious about something that you don't see up there, just ping me at @bshaurette - I'll do my best to get you an answer.