After an entire weekend spent reading up on for loops and while loops, I sat frustrated, literally wanting to bang my head against a wall. I was 19 years old, a week in to my first computer science class ever, and I had no idea how I would be able to successfully finish the project my class had been assigned.
We were told to build a "Gumball Machine" in Python — the professor's way of putting a cutesy spin on us learning to code a series of arbitrary requirements. The program we had to build would randomly choose numbers that were assigned to colors of gumballs. There was to be a specific number for each color — seven yellow, eight green, three blue, etc., but most importantly, one red. The program would run continuously, choosing gumball after gumball, until it reached the sole red gumball. At that point, it would tally up the total number of points from every gumball it chose and give you the total number of points from that round.
While the Gumball Machine is meant to be a simple program, figuring out how to create one is anything but. Learning your first programming language is a lot like learning your first foreign language, and creating a program that runs smoothly is like having a fluent conversation with a native. The computer is unforgiving of the slightest mistake, and usually it won't even tell you what you're doing wrong. You have to figure that out for yourself, usually in a series of maddening bouts of trial and error.
After desperate and countless attempts at every various formula I could throw at my terminal, I finally ran a self-made program that did all of the things I had wanted it to do. At last, I spoke fluently without even so much as a misplaced preposition. And the sense of pride that I felt from completing that first assignment — and the many that followed — was a feeling that subjects like math, English, and science had never provided.
This long and arduous process of learning to code might sound crazy or even pointless to some — on its face, the Gumball Machine is certainly pointless — but that's exactly why more people should learn computer science. I was always good at math and science, but it wasn't until that first computer science class that I actually found those skills to be useful in an interesting way. And I think it's safe to say that I'm not alone in that assessment.
But now that the "brogrammer" stereotype is everywhere, many people who don't fit the accepted nerdy male stereotype have been deterred from pursuing this valuable skill — I should know, I was one of them. My high school was one of the few that offered computer science, but the field's demographics kept me away until college. And women are still pursuing computer science in far fewer numbers once they hit college: Statistics from the National Science Foundation show that while women held 57 percent of bachelor's degrees awarded in 2012, they only accounted for 18 percent of the degrees awarded in computer science — the lowest share of any STEM field.
Clearly, we have a diversity problem in the tech industry, and it's one that needs a solution that goes deeper than initiatives to hire women and minorities. The real challenge is encouraging them to dive in to computer science courses in the first place, and in this case, perhaps the best encouragement comes in the form of a requirement. Making computer science classes mandatory in public schools would do more than simply help a diverse array of students get interested in programming — it would also teach all students to use their brains in ways that no other school subject allows for.
As a field, computer science is constantly evolving, which means that students also learn the importance of autodidactism. The first web programming language I learned, PHP, is now considered almost a relic. But this was just two years ago! The same professor who taught me PHP warned the class of this fact. "It's just the nature of the field," he said. "So my job here isn't so much to teach you how to program, but to teach you how to teach yourself how to program." In a world that's changing as quickly as ours, autodidactism is an incredibly valuable skill. Learning computer science teaches you how to think in a way that expands that ability, and that's a skill that's useful to any student, regardless of what field he or she goes on to pursue.
But those who do choose to pursue a career in computer science also have a higher earning potential. On average, people who know how to code in cities like New York and San Francisco make 20 to 40 percent more than the citywide median salaries. While there would likely be less of a premium on people who know how to code if computer science became a requirement, this upped earning potential does demonstrate how useful these skills are across the board, and how our entire workforce could benefit from teaching everyone these skills.
Of course, implementing a computer science requirement wouldn't be easy. The logistical implications involved with this kind of nationwide educational restructuring would be costly. But that doesn't mean it's not doable. One of the biggest hurdles cited as an issue against this kind of reform is that of recruiting teachers. According to the Bureau of Labor Statistics, the mean annual wage of a software developer is $96,260, while the mean annual wage of a secondary school teacher is $58,260. So where are all of these teachers supposed to come from?
A grassroots program called TEALS (Technology Education And Literacy in Schools), which is being used in 70 schools across 12 states, provides an answer. Volunteer programmers teach computer science classes part-time at high schools while helping teachers learn to create their own self-sustainable programs. Though this specific program wouldn't necessarily be able to match the scale that a nationwide requirement would demand, the approach does signal a solution in which teachers are taught to program, rather than programmers being taught to teach.
Obviously, the specifics are tricky. But the long-term benefits would far outweigh the adoption costs. It's no secret that the U.S. is falling behind in education, particularly math and science. And my guess is that a big factor in that is the lack of innovation that has been incorporated in this education, even in the face of so much evolution in the fields in the real world. Requiring our students to learn computer science is about much more than improved career prospects for them — it's about improving our nation's literacy in the field that is the key to the global future. The skills that a computer science education teaches are beneficial for every modern occupation, and shouldn't be limited to just the people who fit the "brogrammer" stereotype. It's about time that the American education system as a whole — women and minorities included — catches up to the rest of the world. And despite its hurdles, a computer science requirement is the best way to accomplish that.
THE WEEK'S AUDIOPHILE PODCASTS: LISTEN SMARTER
- 43 TV shows to watch in 2014
- How to be the most productive person in your office — and still get home by 5:30 p.m.
- 3 horrific inaccuracies in Homeland's depiction of Islamabad
- Here comes the Pentagon's newest space plane
- The real story behind Deliver Us From Evil
- Extreme haunted houses: Inside Halloween's most terrifying new trend
- The U.S. is about to sell weapons to Vietnam. That's bad news for China.
- 6 things the happiest families all have in common
- How 1,000-year lifespans could remake the economy
- What would a U.S.-Russia war look like?
Subscribe to the Week