crying

Sep 24, 2008 22:32

I finished grading last week's labs today, and the very last question I graded disturbed me greatly. (Some, but not all, of what follows is geeky, so bear with me.) It was a simple problem: read a file and classify the words in the file according to whether they are numbers, words, etc. The general solution most students try is to read a line, loop through each word in the line and classify them individually, repeating until all lines are read. The solution that I graded tried to accomplish the task with four nested loops, each loop changing the parameters of the next inner loop each iteration. At least one of those loops I'm fairly sure didn't actually do anything.

What bugged me about it wasn't the solution itself; I mean, I see a lot of bad code. It was that I couldn't follow it. I try really hard to figure out why their code isn't working and write comments to show them where the bugs are. Not only could I not figure out what was wrong, I'm not sure how any output at all was generated. The output of the program was wrong, but it was an approximation of what was supposed to happen, and I have no idea how! I felt like I was looking at an impossibility.
Previous post Next post
Up