?

Log in

No account? Create an account

Previous Entry | Next Entry

Happiness, Day 23

For the past few weeks I've been working on one particular segment of code. There are restrictions on how it can run and how it can be written. It runs in an environment where the data is frequently bad and deals with two sets of database tables that supposedly track the same events in different ways. Part of its job is to point out discrepancies between the two sets of data.

Over the past few weeks, new things have been added to it. The task document for it is full of different entries in different fonts and colors, pasted from emails, IMs, web pages, and Word documents. We (my supervisor and I) made the mistake of getting the requirements from the subject matter expert, but not showing him the work in progress, so it wasn't until it went to QA that we discovered we'd done several things quite wrong. (To be fair, the subject matter expert didn't think of them as things that could go wrong until he saw the results of the test data.)

The past week has been an attempt to make up for that in the little time left before we are due to actually release the code. The code has been back and forth between me, the subject matter expert, my supervisor, and QA, several times. This morning we had a meeting on what we could cut out of it. This afternoon we discovered that the new guy doing the code builds had made a mistake and promoted the wrong version to test. The dba took it over for a while (because of performance concerns) and scrambled some of the data.

Late this afternoon, a new critical support ticket came in, saying the new version was miscalculating information. We all groaned, in part because we hadn't touched the part that was supposedly malfunctioning. We'd thought that part was fine!

So tonight I'm happy because I dug into the database and discovered that the person who reported the ticket made an error. The program was reporting the data correctly, it was just unexpected data. So this was an example of NP-Complete's Second Law of Debugging: before digging into code and looking for programming errors, always check that you are not accurately reporting bad data.

Vindication: it feels good.

Comments

( 9 comments — Leave a comment )
kalleah
Mar. 20th, 2009 02:29 am (UTC)
So this was an example of NP-Complete's Second Law of Debugging: before digging into code and looking for programming errors, always check that you are not accurately reporting bad data.

HEE.
np_complete
Mar. 20th, 2009 02:55 am (UTC)
HEE.

But so, so, true! Especially when the data comes from someplace you have no control over!

It's been my observation is that programmers tend to assume that the part of the code they had the most trouble with is the part with the problem, and start there. But before tearing into it, it's important to be sure there really is a problem.


Edited at 2009-03-20 03:00 am (UTC)
kalleah
Mar. 20th, 2009 11:50 pm (UTC)
We have two unofficial rules in our support environment. Before doing anything, rule out user error and bad data. As in, your report's wrong? That's nice. Show us why.
earlgreytea68
Mar. 20th, 2009 03:04 am (UTC)
What's the First Law?
np_complete
Mar. 20th, 2009 03:16 am (UTC)
What's the First Law?

When debugging in a production system, back up your database before starting anything. You may or may not be able to fix the problem, but you always can make it worse.
talliroxxor
Mar. 20th, 2009 04:42 am (UTC)
Those last six words should begin with capitals, because You Can Always Make It Worse. *nod*
np_complete
Mar. 21st, 2009 03:16 am (UTC)
Those last six words should begin with capitals, because You Can Always Make It Worse. *nod*

Absolutely!
glory_jean
Mar. 20th, 2009 07:49 am (UTC)
LJ's screwy way of handling html code has helped me prove that more than once. ;-)
np_complete
Mar. 21st, 2009 03:18 am (UTC)
LJ's screwy way of handling html code has helped me prove that more than once. ;-)

After I posted it, I thought, "'Back up the database' is too narrow. It really should be, 'Back up everything!'"
( 9 comments — Leave a comment )