Debugging is fun!
It's occurred to me in the past that one of reasons I watch House is that it's more about problem-solving (and making good guesses) than it's really about medicine, and that it has a lot in common with problem-solving in other domains, like, say, debugging software. In that spirit, here's an hour from my Tuesday afternoon, if it were an episode of House.
(It also occurs to me that this may be the first "creative writing" I've done since my freshman advising seminar. There was probably a reason for that.)
We see a man, mid-40s, at his computer. He's working happily with children playing in the background. One runs up to him and bumps his elbow, causing him to spill coffee all over his desk. It narrowly misses the keyboard. He wipes it up with a few paper towels and gets back to work, but a few moments later an error message pops up on the screen. He swears.
House: So we've got a user with an error page.
Taub: Do we have any idea what caused it?
House: (Sliding folders across the table) Here's the stack trace.
Foreman: It's probably just left over from that bug we fixed last month.
House: Nope. This one was working up until yesterday.
Foreman: Then it's probably something related. The entries were probably written out of order.
House: Probably. Go see if the entries are out of order.
Scene 3 - In House's office
Thirteen: The entries were out of order. It looks exactly like that bug we fixed last month.
Thirteen: It must be the same bug recurring somehow.
House: Am I the only one who's looked at the changelists? We fixed that bug. We haven't seen it in a month. This is something else. Ideas?
Kumar: Maybe they were written fine, and the server just read them in the wrong order.
House: But we read them again, and they're still in that order. You think we read them wrong twice? Either the data store has completely lost its mind and is out to get this one particular user, or we wrote them wrong. (Idiot.)
Thirteen: Maybe something weird happened at the same time as we were writing them.
House: Okay, go look at the debugging logs.
Scene 5 - In the lab
Kumar: Man, these sanitized debugging logs suck.
Thirteen: Yeah, but too many people have access to these logs. You know Cuddy won't let us keep anything juicy here.
Kumar: And there's all these interleaved sessions... I can barely even tell what I'm looking for.
Thirteen: No, look, if we just grep for the session we want... here! The timestamp!
Kumar: That's just saying that it wrote out of order. We already knew that.
Thirteen: ... you're right. It's normal.
Kumar: Told you.
House: Well, if it doesn't look like anything weird happened... Maybe that just means nothing weird happened.
Foreman: Sure, the entries just wrote themselves out of order. Perfectly normal.
House: I mean, maybe these entries always do that. In which case, if we can write the same entries again--
Kumar: But the logs are sanitized! We don't know what data the user entered.
House: Which we would care about if the user had actually entered any data. But according to these logs, they just pressed four buttons.
Taub: You're saying you think it breaks any time a user pushes these four buttons. And nobody's ever noticed before?
House: Look at them! They're pretty weird buttons. Have you ever pushed them in this order?
House: Me neither. Go try it.
Scene 7 - In the lab.
Taub: This is stupid. We're just making this sequence of four edits, there's no way we could reproduce anything this way.
Thirteen: Wait! What was that?
[Dramatically zoom on their faces.]
Taub: It's a NullPointerException!
House: So there was a NullPointerException, and you guys didn't even notice it in the logs because didn't include any context in the grep. (Idiots.)
Taub: But we still weren't able to reproduce the issue the user saw. The entries were all written in order.
House: Who cares? We found a bug. Go fix it.
Scene 9 - The cafeteria
House: How's that refactoring going? Still think that making your code into thirty small files instead of one big one will make it somehow better?
Wilson: Actually, yes. When I moved the code around, I found three subtle bugs that had probably been annoying users for months.
House: Moving the code... (stares into space with a satisfied look)
House: You weren't able to reproduce it because you were running the wrong code.
Thirteen: But we checked! The bug fix from last month was already in production.
House: Not that bug fix, the other one that I made because I was annoyed that NullPointerExceptions could cause entries to be written out of order.
[Team stares blankly at him.]
House: Here, move these four lines back down to the bottom of the method, then push the shiny buttons again.
Taub: He's right, it reproduces.
House: And that bug fix is already lined up to go to production, and the NullPointerException's fixed now too.
Kumar: So you're saying we're done?
Kumar: Well, that was anticlimactic.