The Problem with Computer Science

This is not new to anyone currently involved in teaching computer science or maybe to anyone paying attention to education more generally. We’re struggling to increase Computer Science exposure in K-12.  We’re struggling to make CS count or to make CS more compelling, especially to young women.  Mark Guzdial recently cited this US News article that breaks down all AP test takers by gender.  By far the worst ratio is in CS, where boys outnumber girls almost 5 to 1.  Why is that?

Of course, there are lots of reasons, many of them complex and difficult to solve, many involving gender stereotypes and bias.  Something I’m struggling with, though, is the CS learning curve.  A lot of the resources available online get through the basics fairly quickly, something I do in the first semester or so: functions, variables, loops, strings, maybe arrays/lists.  And it seems relatively easy at first.  Assign a value to a variable, add something to it, see how it changes.  But then it gets harder.  Suddenly you’re not just doing a simple for loop to print “Hello World” five times, but you’re looping through a list of data, checking its validity and updating it.  Still a basic concept in some ways, but now much more challenging.

I’ve seen this happen in my US classes and my MS classes.  Students will breeze through the first parts and then stumble, and then they sometimes give up.  While you can do some pretty cool stuff at the beginning.  To do the really cool stuff requires some much harder things.  Nested loops, nested if’s, functions calling other functions, objects.  These are all things that allow say, a cool video game, which students love to create.  But . . . it’s sometimes hard to get them past the hard stuff to get to the good stuff.

I’m not saying this is why girls in particular don’t do CS.  That’s a whole other issue.  But this is part of it for many kids. The latest hype about coding is that “everyone should do it.” I agree, but the hype suggests you’ll be making Angry Birds in a week.  And that’s just not going to happen for most people.  So a kid shows up to an Intro class expecting to be making Angry Birds like things and instead (if they’re unlucky like I was), they’re calculating the first 1000 prime numbers. Now there are some ways to make those first few assignments more fun.  I’ve done robots and graphics, for example.  And you can build on those to more complex things.  But things can still get hard and can still get discouraging.  So, we might need to find a way to not just have cool assignments at the beginning (the hook), but to have reasons and support to keep going past the hard stuff to get to the really cool stuff.  I think it’s part of why we don’t have so many students taking CS or demanding CS in schools.  They find out it’s harder than they thought and leave.  I don’t know exactly how to fix that, but I keep thinking about it.  Maybe someone else out there has an answer.

20 Replies to “The Problem with Computer Science”

  1. It is definitely an issue. A lot of programming curricula take a graphical/functional approach to hide the inherent complexity (e.g. Kudu or scratch). While I think high abstraction languages have their place, at some point students have to make a leap into imperative styles that can require some heavy duty mental lifting.

    I don’t think that it will work for every student, but I think that focusing on good basic practices like the three great virtues of coders, paper programming and problem deconstruction, and iterative design students are much more likely to persist in surmounting the learning curve to get to the good stuff.

    And I hope to God that we can break students of always having “code a game” as their goal. There are many more interesting problems to attack.

  2. This is a really interesting blog post. I wonder if related problems occur in other subjects – I mean, do students struggle more in math or physics or chemistry as well as CS because they haven’t developed patience and perseverance in problem solving?

    I wonder if you can get by in other classes without developing a problem-solving ethos.. but you just can’t in CS. You have to be persistent and willing to fail quite a lot, sometimes for nothing terribly useful but just because the problem is there.

  3. Dawn, I suspect that Math and Physics and Engineering all have similar issues. I find that those fields don’t get hard until senior year in high school and beyond, whereas I feel CS gets hard sooner. If you want to do App Programming, “real” app programming, you have to go to Objective C. And even the dumbed down versions of app programming (App Inventor or Corona) are not like Scratch. They’re challenging. Also, since CS isn’t required at most schools, students don’t feel like they have to persist. They figure in the intro course, hey, I suck at this and I don’t have to take it, so see ya! I actually find my seniors more persistent and also a quicker study than the freshman in my class. Not always true, but true for most I’ve seen in the last few years.

  4. You’re highlighting an important issue with the learning curve and it’s a problem that I find most after school / summer / drop in programs don’t get. They’re so concerned about exciting kids that they don’t teach much substance. Time and time again I’ve seen kids hit over the head with the college hardcore CS hammer and since they weren’t prepared, the start doubting themselves and in many cases drop the field.

    I also don’t think it’s a matter of being more visual, playing with robots, or any particular problem domain. Kids come with all flavors of interests.

    I’ve tried many things – one thing is when I design a set of lessons, a course, or a sequence of courses, I try to make a path from one to the other. That is, we might play a bit with string manipulation in our intro course and foreshadow the idea that we’re going to play with more interesting things in the following year (such as simple bag of word model language stuff). In that course we’ll foreshadow the stuff to come in the next year.

    Each time we also look back – I ask the kids to think about what they could and couldn’t do the previous semester. When they stop and think about it, it’s really amazing how far they travel in a short period of time.

    And of course, the truth is, some things are just hard and it’s ok for the kids to know that.

    A big help is that I’ve managed to create three years worth of coursework (albeit they’re mostly electives) – the kids KNOW what the light at the end of the tunnel is because they can see the projects that their predecessors have created. That’s big.

    Just a few thoughts here.


  5. I strongly disagree with “I hope to God that we can break students of always having “code a game” as their goal”. I think this is the perfect goal for high school students. There is a lot of coding and problem solving involved, there is a job market for it, all the coding skills you could possibly want to teach are wrapped up in game making and it is a huge attraction for CS to kids. CS has not yet turned into a math class were the goal is “you will need this in college” (which is usually a bald faced lie). CS classes need a better attractor than that. Electives need that carrot dangling out there. The trick is to find a way that the kids do not run face first into that steep learning curve. They have to be taught that game writing is not a trivial exercise and there is some boring, non-game related stuff to learn first. Things like “find the first 1000 primes” is guaranteed to chase away the mainstream kids in the class. I think CS numbers for both sexes are poor because there are too many teachers who like doing Project Euler problems for fun and for some reason cannot see kids are not Project Euler types. Again, a guaranteed method of reducing class sizes. My goal for my students is to make an Angry Birds with Corona but it is a three semester goal. I have 18 kids in Programming II (Python) out of a school of 180 because they know next semester they are going to write Angry Birds in Corona.

  6. Garth – you’re right in that there’s a lot of good CS in games but it also doesn’t speak to all the kids.

    I had a conversation with about 6 of my girls last semester. We were talking about the types of projects they enjoyed when they took their intro course in StuyCS. Back then they did Scheme and NetLogo. NetLogo is very visual and interactive and many students write games.

    In this particular case, most of the girls preferred and were more motivated by Scheme stuff which is all very mathy and not graphical at all.

    Just food for thought.


  7. … calculating the first 1000 prime numbers sounds pretty cool to me… but I also loved number theory…

    Most of the programming I do these days is data-crunching using STATA. And my students like it when I show them how to do something easily by computer that they’ve done with great difficulty by hand. That’s not “real” computer programming, but it is very useful programming and it doesn’t require huge programs with lots and lots of parts. Which, honestly, I did find frustrating in my high school (Pascal) classes. The important things I got out of those classes were knowing what computer programs can do and understanding how to think in terms of macros and loops and Booleans and so on. And, back in the day, understanding that there were slow and fast ways of accomplishing the same thing, though that doesn’t matter as much anymore now that computers are faster. (I have someone else program my “real” lengthy non-STATA programs these days. But I can tell them what I want.)

    I don’t think you have to have games and visuals and so on, though I’m sure that appeals to many people. I do think that showing how programming can make your life easier is just as attractive. The key is figuring what they’ve had to do by hand that was frustrating in the past and showing how it can be done more simply. That doesn’t train people to be computer programmers with the large multi-part programs, but it does train people to work with programmers and to use programming in their own lives for their specific disciplinary needs. SPSS, SAS, R, STATA, Excel, html, etc. are not as intimidating if you’ve had a little bit of Pascal/C/Python/etc. in the past.

    My 7 year old, though, is using Scratch to make games. My husband grew up making games in Basic and C. So obviously that does appeal to some/many people.

  8. Mike, I agree games do not speak to all kids but it has to be an arrow in the quiver. A big arrow. I try to attract the “average” or “mainstream” kids into my classes. They seem to be very attracted to the magic phrase “game writing”. I have yet to find a kid who wanted to find the first 1000 prime numbers but we have to be able to attract those kids too. The great thing about programming is there are so many approaches to learning/teaching it. There seems to always be something we as teachers can offer that will interest a kid to take a look at it. I personally am more the Project Euler type and not a gamer at all. If I were to try and teach what I like to do with programming I might get one kid a year he/she would probably be as weird as I am.

  9. So… now I’m really curious how one would find the first 1000 prime numbers. I would brute force (by taking the square root and dividing by all numbers below that until something went in evenly) it, but that’s gotta be slow and inelegant. Actually I’d get rid of the even numbers (except 2) and then look up the formulas that prime numbers have to be a subset of, and brute force those.

  10. For only 1000 brute force and elegant would be parts of a second difference for the computer. To figure out an elegant, minimal computing time solution would take more time than could be saved. But it is not the product, but the art.

  11. An easy speed up is to keep a table of primes found so far and just test divisibility with them. While Garth’s right – for 1000 brute force is plenty fast, go up an order of magnitude and you’ll start to see the difference.

    The accepted fast way is to use the Sieve of Eratosthenes

    One of my colleagues gave a challenge to his seniors — write a program to find the nth prime number (with N being some number > 1,000,000). All of the solutions were some variation of the sieve but I don’t remember if any of the kids did anything funky beyond that.

  12. Mike, it’s not that games have no place, bug they can’t be the sole goal. If 90%+ of my students only goal is to program a game, then I think that I’ve failed to teach them much cs. Sure, maybe they can produce a game, but it feel like they lack perspective on what they can actually do. Games have a time and place, but there is more out there to pursue.

  13. This cracked me up: “there are too many teachers who like doing Project Euler problems for fun and for some reason cannot see kids are not Project Euler types”. Yes, those were my teachers. And I really liked math, but I’m also very humanities-ish. I like making word games myself. My CS II students today were talking about their favorite projects. They ranged from something involving music to an animation.

    I think I brute-forced the 1000 prime thing. It was literally my first CS problem. I’ve never really had to do anything like it since, though I suppose the concepts involved in doing more elegantly apply to my favorite thing to play with: data, specifically databases.

  14. I began my undergraduate studies as a CS major and quickly switched tracks to studio art. Seems appropriate that these days I find myself doing a lot of web development. This post resonates with me when I recall my own path and how I wasn’t able to get past some of the basic stuff. So what’s changed for me now (not that I’m doing anything complex but I am much more comfortable writing basic PHP to accomplish what I need)? I think part of it is working on things that have real meaning.

    Tons of major web services are opening up their data via APIs these days. It’s never been a better time to help students understand that there is a world of content at their fingertips for them to manipulate. What if instead of approaching beginner assignments as “Lets count the number of prime numbers in 1000” we attempted something like “Let’s create a function that, when given a zip code, will show the latest news stories in that region”. Hell, find out what social networks they’re using and see if there are ways they can grab and manipulate that data at a very basic level. I don’t know that this is the answer but in my case the ability to connect to real things on the web and manipulate them has transformed programming for me.

  15. Tim,

    I agree with you. There was no CS degree when I was in school. I picked up HTML/CSS because I was bored. Little did I know I would pay for a lot of things by taking web side jobs, which eventually became a real job after I gave up on being an English teacher. I had a student working with the Twitter API this semester and I generally tell them to choose projects they’re interested in. For many students, this helps them through the rough stuff, but not for everyone. Or they choose projects based on how easy they might be to complete. I also struggle with time. This is probably true for you, but when I’m working out an issue or developing a cool solution, I will work for hours straight to figure it out. My students often only work within the class period, so in 1 hour 15 minute blocks. Not very conducive to really digging into something. I’m working on how to fix that.

  16. I completely agree that everyone should learn the basics of coding. I started to code in Basic when I was 11 years old. My sister started at the same time, when she was 7. Today, I do not code for a living but find the core skills that I have learned in CS continue to be useful.

    While some people like to focus on the “end product” of a cool game, the longer lasting and broader benefits of coding are more along the lines of problem solving, organization, logic, and analysis. The problem with trying to teach CS without these core fundamentals in mind is that CS is constantly evolving. Languages are evolving. Learning how to program a specific game today is often not relevant when the child is looking for a job after college. But the core fundamentals will still be applicable, and will remain applicable far beyond coding.

  17. Interesting post. The leap from programming robots, kodable and scratch, to ‘real’ programming is definitely a big potential obstacle. I’ve just started teaching computer science to my multilingual first graders, so the biggest hurdle for us at this stage was finding a way in to coding that was accessible to students who are just learning to read. Students learning the very basics of coding definitely don’t anticipate the levels of complexity that lie ahead – if they did, they’d be discouraged. But my kindergarteners and first graders also don’t realize the full potential and complexity of reading and writing either. They are busy learning to spell ‘cat’. If they knew they would eventually be expected to write a 100-page masters thesis, they’d be discouraged. That’s why we focus on the task at hand, and on moving them just one incremental step towards the goal that we have for them. I think if we treat CS more like we treat literacy – as essential at every stage, and developing incrementally to meet the needs of that stage – rather than always focusing on meeting future needs (like college applications, jobs, and making money) then we’d be doing our younger students a favor.

    My interest in software engineering started when I started my blog. I wanted to share my teaching resources, but I didn’t like the wordpress template. So I started messing with the HTML to hack it into something I wanted. From there, I progressed into learning about other languages and other ways to use code to suit my needs at the time. The focus was always on a current problem that I had personally identified as needing to be solved, not on the code itself. My ambitions were always to solve my current problem, never to ‘become a software engineer’ or ‘learn to code’. Learning to code was a means to an end. I think we can do the same with students. Keep them focused on self-identified goals that they want to solve, and teach them the skills they need to solve them. So maybe for some kids that will be building a game, for some it will be web design, for some it will be automating mathematical processes. As students’ thinking and ambitions steadily increase in complexity and scope, so will their code.

  18. Charlotte, I think you make some very good points. My biggest struggle with the learning curve is in Middle School, where they get ahead of the task at hand and/or I expect a little too much of them sometimes. In Upper School, I can usually get students to go toward their interests. What I struggle with there sometimes is students seeing that a problem can be solved using computing.

Comments are closed.