Monday, January 3, 2011

Pseudocontext in Computer Science

Can you imagine a programming assignment or example where "common sense and real-world knowledge are not needed"?  Math teacher (and now PhD student in education) Dan Meyer proposed that many math problems fit into this category, exhibiting what he calls pseudocontext.

Dan settles on the following definition of pseudocontext:
  1. context that is flatly untrue: "a basketball team scores two points every minute for the duration of the game."
  2. operations that have nothing to do with the given context: "the age of Mark's dad is three more than four times Mark's age." 
 And in an earlier post on the topic, describes why it's a problem:
We need to call pseudocontext out when we see it, call it out by name. If we invite pseudocontext in our classrooms without condition, it becomes harder and harder to tell the difference between the real and the unreal. It becomes easier to excuse all kinds of bizarre unreality because, well, I mean, this is math class and in math class it's possible to know that "in January of the year 2000, I was one more than eleven times as old as my son William while in January of 2009, I was seven more than three times as old as him" and yet not know how old your own son is.
I've been thinking about some of the assignments we can see in computer science classes and how far from reality they can seem, and wondered whether we suffer from the same issues.  While it's true that you can rarely make totally realistic assignments in undergrad courses due to limited time and a wide variety of issues involved from security to scalability, I do think that the context of some assignments and examples ends up off the mark.

It's certainly not as clear as with math problems, however.  In some cases, questions seem boring and pointless, but may not exhibit pseudocontext (in fact, many may just lack any context).  For instance, upon looking at some of my first-year C-programming assignments, I found a lot of utterly useless stuff.  The first coding task involved asking for someone to input a number, checking if it was a valid integer, then outputting it again.  Is this a complete lack of context? Or is it pseudocontext since nobody would ever do it in that form, even if we do occasionally ask for input in larger programs?

The last assignment from the same class makes use of a text file containing a list of dictionary words.  The story is that we're implementing a simple spell checker, but even someone who had never programmed before university (like me) could tell that you'd never check spelling by linearly searching a giant linked list of words.  I mean, it's possible, but nobody would actually ever do that.  I'd put this one under part two of the above definition, and knowing how much of a toy example the assignment is could be really demotivating for those who aren't passionate about code itself (and the assignment is far too easy for those who are!).  At least if we had to implement something we can tell is a toy example, it could be more interesting than a spell checker.

I have to consider assignments from my favourite first year class and professor, though I don't think these are the worst offenders (at least they tend to be more interesting topics).  The second one has us build up a few classes representing aspects of a movie theatre: the patron, the theatre, and the box office.  This seems reasonable and is certainly more fun than the spell checker, but the context of it is strange.  Why would the patron be represented in code? In a real ticketing system, wouldn't the patron simply be the user (assuming an automated system)? There doesn't seem to be a need to store his/her name, age, and tickets in the actual program.  Are we just trying to create a simulation for testing purposes? If so, why isn't that explained? I'm guessing the same level of complexity and learning objectives could have been achieved with an assignment that felt a bit more like a real theatre system.  Or, perhaps it's better to stay away from trying to create a system that you can't possibly do justice in a small assignment?

While searching for more examples, I ran into the issue of deciding whether they had pseudocontext or not over and over again.  Many assignments have boring context or none at all, which I think is a big issue in computer science itself.  There's no doubt that many assignments during my undergrad felt unrealistic.  However, there are collections of great assignments that do feel real (example), so it is possible!

This is something that needs more deep thought, and I'm hoping you'll share any examples you might come across! If you blog about it, leave a link to your post in the comments so I can check it out.

7 comments:

Thomas Cort said...

I believe that students who aren't taught with realistic assignments will develop unrealistic solutions.

"I mean, it's possible, but nobody would actually ever do that."

Never say never! I was on a code review team looking at code written by a large multinational corporation, and I saw a bubble sort implementation used to sort a Collection of objects. Not only did the programmer ignore Java's Collection.sort() methods, the programmer implemented one of the least efficient sorting algorithms!

Gail Carmichael said...

Sounds like something from Daily WTF - good point!

Collin said...

here's a problem that's real because i actually wanted something to do this: given the JUMBLE game and a collection of letters (e.g., 'mugpin') whose original word I couldn't figure out, what's a better way to find said word than typing

$ grep '^......$' /usr/share/dict/words | grep m | grep u | grep g | grep p | grep i | grep n

? Then generalize the scheme for words with repeated letters like 'uncocat'

my hack is here.

Gail Carmichael said...

I like these sort of problems. :)

Dan Meyer said...

Interesting analysis, Gail. I'm not sure what the analog from math is here.

Not for nothing, I just finished my first quarter of CS. Java. The last assignment was a Facebook knock-off called FacePamphlet. I can't even begin to wonder if it was pseudocontext. I enjoyed it. I felt like I was solving a real problem, even if that problem was vastly simplified (no persistence, for one thing) and the tools we used to solve it (arrays and GCanvas) weren't used by Facebook programmers. Should CS teachers reject that kind of simplification?

Gail Carmichael said...

I'm not sure either. There's no doubt that we have to simplify things from the real world in classroom assignments (for example, it's unlikely you would have been able to worry about scalability and security in your assignment as Facebook has to). And interesting applications like this make a big difference I think.

I'm starting to wonder if the issue for us isn't pseudocontext as you've defined it, but simply "how interesting is this context to modern students." The theatre example, while not a perfect representation of how such a system might be implemented (though I admit to being overly picking in analyzing it), is a lot more interesting than the spell checker idea, and I'd say even less misleading.

I took a quick look at FacePamphlet and it looked like a reasonable representation of the components that should be involved. It even seems to match with reality fairly well, at least in terms of what you'd want out of the end product. Maybe that's more important than how it's programmed in finding pseudocontext - is this a product you'd actually want to build.

Still more thought needed - but I feel like I've got a little further! Thanks Dan! :)

Collin said...

i loved your list of examples! i plan to work on the '8 puzzle' in my spare time :)

a few more... iirc my first python script was to solve the "coconuts" problem; other interesting problems include solvers for "sudoku" and "kakuro" games with input format specified to make the problem tractable even for an undergraduate assignment...

Post a Comment

Comments are moderated - please be patient while I approve yours.

Note: Only a member of this blog may post a comment.