The next generation of Python programmers

This article brought to you by LWN subscribers Subscribers to LWN.net made this article — and everything that surrounds it — possible. If you appreciate our content, please buy a subscription and make the next set of articles possible.

In a keynote on day two of PyCon 2014 (April 12), Jessica McKellar made an impassioned plea for the Python community to focus on the "next generation" of Python programmers. She outlined the programming-education problem that exists in US high schools (and likely elsewhere in the world as well), but she also highlighted some concrete steps the community could take to help fix it. She expressed hope that she could report progress at the next PyCon, which will also be held in Montréal, Canada, next year.

Statistics

McKellar used the US state of Tennessee (known for "country music and Jack Daniels") as an example. That is where she went to high school and where her family lives. There are roughly 285,000 high school students in Tennessee, but only 251 of them took the advanced placement (AP) computer science (CS) exam. That is 0.09%. AP CS is the most common computer science class that high school students in the US can take.

She showed a slide with an Hour of Code promo that had various "important, famous, and rich people", including US President Barack Obama, who are enthusiastic about students learning to code, she said. They believe that all students should at least have the opportunity to learn how to program in school.

But the reality is quite a bit different. In terms of AP participation by students, CS is quite low. She put up a graph of AP test takers by subject for 2013, showing CS with roughly 30,000 takers nationwide, slightly ahead of 2D studio art and well below subjects like history or literature, which have 400,000+ participants each.

The problem, typically, is the availability of classes. McKellar's sister goes to high school in Nashville, Tennessee. She likes electronics and would be interested in taking a class in computer programming. The best that she is offered at her high school is a class on learning to use Microsoft Word, however. That's not just a problem for Tennessee, either, as there are roughly 25,000 high schools in the US and only around 2,300 of them teach AP CS.

She put up more statistics, including the pass rate of the AP CS exam, which was 66% in Tennessee. But of the 25 African-American students who took it, the pass rate was 32%. She showed maps of the US with states highlighted where no African-Americans took the test (11 states), no Hispanics (7), and no girls (3). One of the latter was Mississippi, where the lack of female test takers may be somewhat self-reinforcing; any girl in that state may well get the message that AP CS is not something that girls do. In addition, any girl who considers taking it will have to worry about her results being scrutinized on a national level: "I better pass or I will be a stat people talk about".

AP class participation by gender was next up. There are more AP classes where girls outnumber boys, but for math and science, that balance switches. CS has the worst gender imbalance of any AP class.

The Python community cares about this because it spends not just time and money, but "blood, sweat, and actual tears" trying to improve this imbalance, which starts in high school and even earlier. McKellar said she understands "how empowering programming is" and she wants students to have the opportunity to "engage in computational thinking skills". She wants the politicians that are making decisions about how the country is run to have that experience as well. Fixing this problem is important to the long-term success of the Python language as well.

What can be done

It was a "depressing introduction", she said, with lots of statistics that make it look like an "intractable problem". But there is some solace that can be taken from some of those statistics. While AP CS is the most gender-skewed AP exam, 29% of the test takers in Tennessee were girls. That is largely due to one teacher, Jill Pala in Chattanooga, who taught 30 of the 71 girls who took the exam. McKellar asked: If one teacher can make that big of a difference, what can a 200,000-member community do?

To answer that question, she asked three CS education specialists. If one is "armed with a Python community", what can be done to help educate the next generation of (Python) programmers? She got responses in four main areas: policy, student engagement, supporting teachers, and curriculum development. She said that she would be presenting the full fire hose of ideas in the hopes that everyone in the audience would find at least one that resonated.

Policy

To start with, in 35 states computer science is only an elective that doesn't give any math or science credit to a student who takes it. If a class doesn't "count for anything", students don't want to take it, schools don't want to offer it, and teachers don't want to teach it. One thing that audience members could do is to "pick up the phone" and ask legislators and school boards to change that.

There is also a lack of per-state data on who makes the decisions about what high school graduation requirements are. There is also a lack of a single place to go for per-state credential requirements for a teacher to be certified in CS. This is a problem for policy makers because they have no way to judge their own state policies by comparing them with their neighbors. It is something that could be fixed "in a weekend" with some Python, web scraping, and version control, she said.

Another problem is that AP CS is still taught in Java, which is a bad language to teach in. That is not her "hating on Java", but it is something that teachers say. If you think about what goes into writing "hello world" for Java, it doesn't allow deferring certain concepts (e.g. classes, object-oriented programming), which makes it difficult to understand "if you've never written a for loop before". Java is also getting "long in the tooth" as the AP CS language. Pascal was the that language for fifteen years, followed by C++ for six years, and now Java for the last eleven years.

People have been gathering information about what languages colleges use, what languages college teachers wish they were using, and what language they think they will be using ten years from now. Some of that information is compiled into Reid's List (described in this article [PDF], scroll down a ways), which shows that Python's popularity with college CS programs is clearly on the rise. But Reid's List has not been updated since 2012, as it is done manually, partly via phone calls, she said.

The 2012 list also shows Java with a clear lock on first place for the first programming language taught (Java 197, C++ 82, Python 43, ...). But, McKellar believes that Python's numbers have "skyrocketed" since then. She would like people to engage the College Board (which sets the AP standards) to switch the AP CS exam from Java to Python. The College Board bases its decision on what language teachers want to teach in, so the rise of Python, could be instrumental in helping it to make that decision—especially if that rise has continued since 2012. AP CS courses in Python would make for a "more fun computing experience", she said, and by engaging with the College Board, that change could happen in four to six years.

Student engagement

Students don't really know what CS is or what it is about, so they don't have much interest in taking it. But there are lots of existing organizations that teach kids, but don't know programming: summer camps, Boy Scouts, Girl Scouts, etc. This is an opportunity for the Python community to work with these groups to add a programming component to their existing activities.

There are also after-school programs that lack programming teachers. The idea is to take advantage of existing programs for engaging students to help those students learn a bit about computer science. That may make them more likely to participate in AP CS when they get to high school.

Supporting teachers

CS teachers are typically all alone, as there is generally only one per high school. That means they don't have anyone to talk to or to bounce ideas off of. But the Python community is huge, McKellar said, so it makes sense to bring those high school teachers into it.

Pythonistas could offer to answer lesson plan questions. Or offer to be a teaching assistant. They could also volunteer to visit the class to answer questions about programming. Inviting the teacher to a local user group meeting might be another way to bring them into the community.

Curriculum development

There is a new AP CS class called "CS Principles" that is being developed and tested right now. It covers a broader range of topics that will appeal to more students, so it is a "really exciting way to increase engagement", she said. So far, though, there is no day-to-day curriculum for the course in any language. That is a huge opportunity for Python.

If the best way to teach the CS Principles class was with a curriculum using Python, everyone would use it, she said. Teachers have a limited amount of time, so if there is an off-the-shelf curriculum that does a good job teaching the subject, most will just use it. The types of lessons that are laid out for the class look interesting (e.g. cryptography, data as art, sorting) and just require some eyes and hands to turn them into something Python-oriented that can be used in the classroom. Something like that could be used internationally, too, as there aren't many curricula available for teaching programming to high school students.

Deploying Python for high schools can be a challenge, however. She talked with one student who noted that even the teachers could not install software in the computer lab—and the USB ports had been filled with glue for good measure. That means that everything must be done in the browser. Runestone Interactive has turned her favorite book for learning Python, Think Python, into an interactive web-based textbook. The code is available on GitHub.

Perhaps the most famous browser-based Python is Skulpt, which is an implementation of the language in JavaScript (also available on GitHub). There are currently lots of open bugs for things that teachers want Skulpt to be able to do. Fixing those bugs might be something the community could do. Whether we like or not, she said, the future of teaching programming may be in the browser.

Summing up

Since we are starting from such terrible numbers (both raw and percentage-wise), a small effort can make a big difference, McKellar said. The Python Software Foundation (PSF), where McKellar is a director, is ready to help. If you are interested in fixing Skulpt bugs, for example, the PSF will feed you pizza while you do that (in a sprint, say). It will also look to fund grant proposals for any kind of Python-education-related project.

She put forth a challenge: by next year's PyCon, she would like to see every attendee do one thing to further the cause of the next generation of Python programmers. At that point, she said, we can look at the statistics again and see what progress has been made. As she made plain, there is plenty of opportunity out there, it just remains to be seen if the community picks up the ball and runs with it.

Slides and video from McKellar's keynote are available.

