The Hard Part of Computer Science: Algorithmic Thinking

Most students come into a CS class thinking that the real challenge of Computer Science will be learning syntax for a particular programming language.  And while curly braces and semi-colons do indeed sometimes trip people up, the real challenge is creating the algorithm you want to code in the first place.  You can always look up syntax, but constructing the algorithm is where the hard work gets done.

Dawn DuPriest and I are on the same wavelength these last few days.  She, too, is thinking about this problem, and has some good strategies for helping students through.  She’s working with 6th graders.  I’m working with sophomores and juniors and I’m having the same issue.

My CS II students were asked to write a program to encode a message and then write a program to decode a message.  The pattern they were to use was a Caesar cipher (shifting each letter over a few in the alphabet), so that the decoder could more easily be written.  This is a program I thought they could have done in a single class period (1 hour and 15 minutes), but so far, we’ve taken about an hour and a half (end of one class plus all of the next).  I wrote the programs in 4 or 5 lines each in about 15 minutes total.  This is supposed to be review, not new material.

A couple of things come to mind.  I think last year I held their hands too much, helping them come up with code snippets to solve their problems, so they can’t remember, for example, how to loop through a list.  But two, I think they didn’t abstract out from the coding they did do to the algorithmic level.  They’re not really breaking down the problem into parts.

Here’s how I broke it down:

1. Get a string via input.

2. Loop through the string and change each letter according to a set pattern.

3. Save the resulting string.

That’s pretty basic, though that second item can get broken down further, because you have to figure out how, exactly to tell the computer what the pattern is and do the substitution.  I’m not allowing the use of dictionaries/hash tables yet, so that piece is a bit tricky, and there are at least two ways to do it that I thought of off the top of my head, but there are probably infinite ways!

They have a quiz on Wednesday, which is open book, but I think I’m going to add an algorithmic thinking question to it and discuss it with them thoroughly.  They’re not going to make it through object-oriented programming if they can’t break down their problems into parts.  I’ll let you know how it goes.

We’ve already talked about algorithms in CS I, but seeing what’s happening in CS II reminds me that I need to really drive this concept home.  I have changed some things in CS I that I think will work better, including more pair programming.  Dawn found that group work really helped.  Talking through the possible strategies and having a peer steer you correctly can help.  So, we’ll see.

4 Replies to “The Hard Part of Computer Science: Algorithmic Thinking”

  1. I tell my students that coding is a minimum wage job, what to code is where the bucks are. Coding is easy to teach and learn, what to code (algorithm, program design, etc) is really difficult to teach and learn.

  2. We still teach heavily proof-based geometry as well as logic/discrete math. I get the kids before they’ve gone through that usually, though, since that’s sophomore year and I have a lot of freshmen.

    Vicky, I didn’t like to flowchart either, and I don’t, but I do write out steps.

Comments are closed.