Skip to content
March 27, 2008 / Ben Chun

How to Teach CS

I’ve been grappling with a lot of ideas about teaching CS and how to teach CS for the past few days. I recently reflected on my own experience with functional programming and closure. Then Alfred Thompson wrote about teaching XML in schools. And of course it’s come up this year in my classes, as I tried to teach the basics of ActionScript to my 12th grade students. Tried. The result ended up being more like “copy this code and modify it”. I didn’t give enough exercises or teach with enough granularity to expect students to really understand what they were doing. I need to build that more carefully next time. I have all the tools to deliver it. I just need to develop the curriculum, and be sure that I understand my goals.

Part of the problem here is that I need to unpack my own knowledge about CS and programming. With an undergrad education and years in the industry, there’s a ton of information and practical experience that I rely on to get things done but don’t consciously or explicitly deal with. It’s time to bring that out. It’s time to slow down my teaching, build better assessments, and script the presentation more closely. I think I need to build a concept map and figure out the dependencies, then try to project that onto a calendar.

In addition to my APCS and Intro Programming classes, next year I’ll also have the opportunity to teach a 6 week unit on JavaScript to 10th grade students. This will likely be their first programming experience beyond HTML. I’m guessing that I will have about 4 hours per week of usable time, so 6 weeks gives me 24 hours total to teach something about JavaScript. Obviously it’s going to be difficult to even approach the object-oriented concepts of classes and inheritance. It probably makes more sense to just focus on syntax and teach the DOM. I’ll need to include functions and callbacks. That should be enough.

I think the main sense I want to endue is that of debugging. If I can get students using document.write() and alert() to provide themselves with information, with output, I feel like that’s a key tool — not just practically, but also conceptually. Reading output and checking state along the path of execution what turns programming from an abstract problem into a testable, solvable puzzle. When you can see what happens as a result of the code you wrote, and choose the points that you want to see those results, it becomes a Rubic’s cube instead of a math problem. If that’s all they get from it, I’ll be happy. But hopefully they’ll come away with the seed of an understanding of what programming is and what it feels like to spend time doing it, along with some finished products they can see in a browser.

More than other subjects, it seems like there are a huge diversity of approaches to teaching CS. This is probably because there are a profusion of languages and development environments, as opposed to say math, where there’s only one algebra in common use. I almost don’t know where to start researching what other people have done in terms of introductory CS classes that are intended to go deeper conceptually than just the syntax of calling on pre-built libraries of functionality. Obviously you can’t get a high school class deep into theoretical computer science in 6 weeks, but it seems like there might be some ways to get at the underlying ideas that work better than others. Suggestions, anyone?

6 Comments

Leave a Comment
  1. Andy / Mar 27 2008 2:06 pm

    If you’re going to be doing a JS course, you absolutely cannot skip (at least looking at) Firebug. Ideally, running under Firefox (which is a good browser for many other reasons), though Firebug Lite works if you must use something else. You mentioned document.write() and alert(), but console.log() lets you see the objects themselves, and the “command line”-ish bit it provides is also pretty useful if you’re doing functions (or objects, which are.. interesting in JavaScript).

    As for “copy this and modify it” – that’s a pretty decent way to learn things – for a while. It’s certainly what I do when I learn a new programming language. But a general understanding of how some things work is important. If you’re teaching APCS, you’ll end up doing Java, and if you have any kids in a JavaScript / ActionScript (they’re both derivatives of ECMAScript now) class, they’ll quickly realize that many things are essentially the same. Typing is a bit stricter in Java, but functions work the same everywhere. So teaching some basic concepts (from experience: variables, functions, and possibly variable scope, if possible) first should let them understand exactly what it is they’re copying and modifying.

    Just my two cents or so. Good luck!

  2. Krug / Mar 27 2008 3:02 pm

    While I haven’t done much with Javascript I have used this program to teach high school students the basics of programming (sequences of commands, selection statements like if, and looping)

    http://scratch.mit.com/

    You aren’t going to hit any CS topics with it but its a nice non-threatening way to get kids interested in the power of programming.

  3. zephoria / Mar 27 2008 5:25 pm

    While I think that the MIT approach is great for mathematically-motivated, theoretically-oriented students, I actually think that a CS curriculum based on lambda calculus is actually the worst way to go for teaching most students.

    When I used to teach intro to CS to different populations, I read a lot of textbooks looking for good ones and I always came back to the stuff that Eric Roberts at Stanford did: http://www-cs-faculty.stanford.edu/~eroberts/books/index.html

    I haven’t read his new one, but “Art and Science of C” does a surprisingly good job of getting students into programming through simple, practical exercises that make sense. I bet the new one is even better and more modern.

    Of course, this is when the goal is to teach computer science… I think you’re facing another dilemma. Computer science is not the same as programming, and certainly not web programming. I started watching web programmers build code in recent years and I saw something startling: most copy/paste for a living. Unlike traditional programming, web programming is mostly comprised of searching the web for examples that are close to what you want and then modifying them to get what you want. It’s a lot of trial and error, a lot of debugging and trying to understand the logic, and the learning is very bottoms-up. Futz around enough and learn from what works and what doesn’t work.

    Watching web programmers work, I started thinking that maybe CS classes for non-majors are going about it all wrong. Maybe there are lessons from MySpace layouts. Perhaps the answer is to give code to students and push them to modify it, to learn how to read the code by trying to make changes in what’s going on, by learning to Google what they’re seeing rather than looking through a structured book. Maybe it’s about starting with all of the crutches and then slowly pulling away the crutches, unpacking the code, teaching them to search and debug based on visual output or Firebug.

    So I think that one of the other questions you have to ask yourself is what you want your students to get out of this class. How many of them are going to become computer scientists? CS is great for teaching certain kinds of logic, but I suspect that learning to interpret, tear apart, and modify is actually more practical for most people. It still gets at certain logic skills (and definitely debugging), but I also think that it’s a skill that will be useful in the future, not just for web programming. We are certainly seeing that with MySpace.

  4. Leigh Ann / Mar 28 2008 4:03 am

    I think your initial concerns are definitely worth exploring. Without knowing whether this is an embedded section within a web design course, or part of a larger survey course (like computer applications) its hard to judge for you what topics you should cover.

    However I would encourage you to take a good look at what your goals are for the 6 weeks and how they relate to the overall theme of the course. If it is a web design course, the copy/paste mentality may not be so bad (especially if you do not foresee these students following this directly with jobs in that area :)

    If it is part of an applications course, then something like scratch, or Alice could be a good way to talk about control structures, objects and thinking like a programmer with a small amount of overhead.

    If you want to do something a little more meaty with the programming section – why not take a look at the media computation materials coming out of Georgia Tech? The concept is that by using either Java or Python students learn basics by manipulating either images or sounds. They have had a lot of success with their non majors and it could give your students a taste of programming in a context they love to explore. (how many technology teachers have not watched students in a lab playing with paint? or the microphone and its settings?)

    I also recommend if you want to insert more “computer science” rich topics into your curriculum look at the Computer Science Unplugged materials. There are some wonderful activities there that engage students in high level computer science topics without requiring any programming at all.

    As with any subject good instruction is taking your goals for the unit, the goals for the course, topics that motivate you (because if you are excited the students will be too) and tossing them in a pot with a dash of what the students find interesting, mixing it all together and then dishing it out in serving sizes that are easily digestible and assessable. :)

    Email me if I can help you find classroom lessons and materials for any of what I mentioned above.

  5. Ben Chun / Mar 28 2008 5:17 pm

    Andy — I definitely use Firebug all the time, myself. I’m not sure I want to hand them such a powerful tool off the bat. But we can probably work up to it. There’s a similar type of dilemma when it comes to the IDE you use for teaching Java. As much as you or I love to use Eclipse or NetBeans, it actually helps kids to start with something simpler and then they can appreciate why the tools work the way they do, and also truly understand what they are doing. I bet your appreciation of console.log() is informed by experience trying to debug using alert(). It’s tricky because you wouldn’t make a friend work through all the exercises, but for students it’s actually necessary. I struggle to find the balance.

    Krug — I looked at Scratch earlier this year, but wasn’t sure what to do with it. I’m skeptical about the visual metaphors for loops and whatnot, but I haven’t tried them with kids. Do they “just get it”? Perhaps I will throw it at my freshmen later this year and see what sticks.

    danah — Thanks for the tip on the Roberts book. He also has a Java book and APCS uses Java so I’ll have to take a look at that. You make a great point about how a lot of the world is copy/paste now. I’ve definitely been writing more glue code and less stuff from scratch. I feel like my CS background helps me understand and debug things quickly, but perhaps it’s not necessary for everyone to start from the beginning.

    Leigh Ann — The JavaScript mini-course will be embedded in a larger web design course that includes HTML, Photoshop, and Flash. The reminder to use backward planning and design is a good one. Also, thank you for all the resource ideas! From what you wrote I found:

    Media Computation in Java
    Computer Science Unplugged

  6. Andy / Mar 29 2008 10:15 am

    Ben, you make some good points. In terms of complexity, the IDE the CS courses at my school use tends to be XCode initially, though I’m not sure if you’re using Macs, so that may not work. It’s pretty simple and clean, if a bit buggy at times. (The APCS kids ended up using Eclipse, and none of us had any problems with it, but, as you said, it’s probably because of experience with other systems.)

    I can certainly understand why perhaps the power of Firebug isn’t the best for beginners, so alert()ing is probably fine to some point. That said, there’ll probably be a point at which it makes sense to introduce the debugging capabilities of whatever you’re writing in, as those will often be much better than alert() or printing – that’s why they exist. But, yes, thinking about it, Firebug probably isn’t the first thing you want them to jump into.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: