Why Sherlock Holmes Would Have Made A Kick-Ass Programmer

Posted on Wednesday, October 8, 2008

One of the few quotes I know from the world of Sir Arthur Conan Doyle's Sherlock Holmes goes something like this: "When you are trying to solve what appears to be a mystery, eliminate the obvious first. Whatever is left, no matter how extraordinary, is the answer..."

Sometimes, those of us who think we have a good grasp on programming fall prey to over-looking the obvious. We get a bug in our code, and we can't figure it out. We rewrite large sections of code we think are the problem, again and again, cursing profusely when the error persists.

Finally, we break down and seek help from our peers. If we're lucky, one of those guys might ask the magical question that leads to a memorable fore-head smack, and the problem is solved...

I just had one of these oh-so-enjoyable moments. I've been trying to build a new script for this site to update my new page content, and it's been failure after failure. Finally, I seek help from one of the resident instructors I know (who happens to be fairly good at this web-thing) and asked him for suggestions. One of them? "Have you tried echoing the query string to the screen after the post, so you can see what you are sending to the database?" he asks. "Uh, no." I says.

D'oh.

Oh, look. The primary key field is empty. Hey, that might cause problems, right?

...

Yup.

SMACK!

:p