29 January 2006

Coincidence? Bug? You Decide

I am working on a little course-ware Web application for a professor. The application went live Saturday, and he's announcing it in class tomorrow morning. Students log in, enter little news items, get graded...nothing too earth-shattering. It's crucial, of course, that they be authenticated without doubt, and that the work done gets ascribed to the right student. So I'd spent quite a bit of time on that code.

I posted a sample news item when I turned the switch Friday night, and noticed Sunday morning that two others had appeared. OK, one's a sample from the professor, and the other...

Hmm. It appears to be from a student. Nothing wrong with that--even though the announcement hasn't been made, he might have followed the link from the course home page. But he's the very FIRST student in the database. As a pilot, first-aider, and programmer, I have learned to distrust coincidences.

Well, someone had to be the first to post an item, after all, and...how many students are there?

ONE HUNDRED EIGHTY FIVE??!!

RED ALERT! Call the prof! The authentication mechanism is clearly broken! At odds of 185 to 1, no sane programmer is going to believe that their software is bug-free. Ah-OOOOH-GAHH! Ah-OOOOH-GAHH! Monday morning I'm going to have a student lynch mob, 185 strong, pounding on my office door, demanding the head of the feeb that cost them credit for their hard work!

My Sunday is spent wallowing through the code and pinging the prof with increasingly frantic emails. Can't find the bug.

Comes an email from Mr. Head of the Alphabet: Yep, that was me. Hope it didn't mess anything up, he says politely.

I am shocked. Appalled at the card life has dealt me. Never in my wildest hopes did I dare to believe the coincidence would fall my way. My professional cynicism is, momentarily, shaken. Next thing you know I'll be spiraling down through some hole in the clouds, and there'll be an airport at the bottom of it.

ONE DAY LATER:

All right. This is just spooky. Got a bug report from one of the students -- the app seems to have just lost part of her input. (There are only two fields on the form, how could it lose anything?) So she emailed me the info that was supposed to be included, and I hand-hacked it into the database record her attempt had created. Yep, there it was, the second student-created item. So I started to email her a reponse, and when I saw to whom I was writing, I got the cold shivers.

You guessed it. She's number two on the alphabetical list of 185 students. If you're keeping score, we're now up to a 1 in 34,225 chance that this is a coincidence, and I'm starting to mutter and wear tinfoil hats.

YOU KIDS STOP THAT, NOW!

1 Comments:

At 10:53 AM, Anonymous Anonymous said...

Good one. Reminds me of a tale from long ago, when I was just a youth proto-hacker. My dad received a power and light bill that was a magnitude more than usual. He was quite upset and was going to call them the next morning. I took a look at the bill and spotted an obvious "computer error" -- the gas reading was 1024 units. Any hacker worth his or her salt knows that is two to the power of ten (2^10), a nice clean binary number. I thought he should mention this when he called. Then he checked the meter, and the reading made by the meter reader, and the real answer became obvious -- it was mis-read (easy to do with the bizarre alternating-rotation dials). It should have been 24 units, not 1024. The fact that the number was a clean power-of-two was a complete coincidence.

 

Post a Comment

<< Home