I normally don't blog about what I do (I'm a software developer), because 1) I've already got a work blog that's more suited for that, and 2) I'm a software developer, so most of the time it's not amusing. Sure, I find it interesting, and I learn things every day. However, unless you already lean towards Computer Science, it's not going to be very amusing to you. So, for the sake of keeping my audience (all 4 of them) happy, I stay away.
Today, I'm going to break that rule, because my work actually did cause mild amusement. So, without further ado ...
I've got a deadline coming up fairly soon, so I've been coding away for the last few days. It's not busy enough where I'm stressing about it, but let's just say it's a little easier to concentrate on my work these days. In it of itself, that's not news-worthy, but because I've been more productive lately, I've also been generating more working code lately. That's nice when everything works, but when things start going bad, that also means a bigger puzzle to figure out.
This morning, I was working on something I'd started last week. Basically, I'm implementing this thing where you can select an item from a list, and then move it to a different list. You can also do the reverse, should you so choose. Anyhow, I started testing it, and I noticed that it only worked when I moved the item in one direction. The reverse operation just made the item disappear from both lists. Aw, crap.
I fired up the debugger, and started looking through my code. Remember, there was a fresh batch of newly added code, so the mistake could have easily been anywhere in there. I stepped through everything, and it checked out. The item was in the right lists at the right time, but the stupid screen just wouldn't display things properly when I moved items in one direction. No matter what I did, the item just wouldn't show up on the destination side. I'd say that probably took about 30 minutes, and I had nothing.
All right, so I started thinking. Maybe the lists weren't refreshing properly. That's supposed to be something that works automagically (if you absolutely must know, I was setting the ListBox.DataSource & then calling ListBox.DataBind() ). At this point, I was worrying a tad, because anytime you have to mess with the automagic stuff, you're in trouble. Think of it this way - even if you're a mechanic, you expect certain things to just work in your car. The more you have to take things apart, the harder it gets to fix. Same deal here, I was starting to take apart chunks of the engine.
Anyhow, I did some reading & learned how all that stuff works. That gave me some ideas to try, but nothing fixed this disappearing item problem. It kept disappearing on me. So, I now had a bunch of new-found knowledge about the internal workings of some code that Microsoft wrote, but I was out of 90 minutes & my code still didn't work. Oh, and at this point, I was starting to mutter things to myself.
At this point, I resorted to slowly, methodically going through everything one more time. It's the slowest way to work, but if you're methodical about it, you can find the problem by brute force. And, as it turns out, it worked. After another twenty minutes or so, I spotted the problem: when I was moving the item, I didn't tell it what text to display. So, my item was in the right spot all along, but it looked invisible because there was no text there. Going back to the car analogy, that was roughly the equivalent of me complaining that the car wouldn't start when I hadn't filled up the gas tank. It really was that stupid.
After letting out an audible groan & laughing at my own stupidity, I fixed the problem. Frankly, I'm proud of myself for not swearing out loud. Regardless, it took two hours of work, and all sorts of grumbling, but I finally remembered to fill up the tank. Maybe that person who called me retarded was on to something, after all.
Now I just hope that people who end up using this system better like that feature. Otherwise, I'll have admitted to being stupid for no good reason. Well, other than for a laugh or two.
Today, I'm going to break that rule, because my work actually did cause mild amusement. So, without further ado ...
I've got a deadline coming up fairly soon, so I've been coding away for the last few days. It's not busy enough where I'm stressing about it, but let's just say it's a little easier to concentrate on my work these days. In it of itself, that's not news-worthy, but because I've been more productive lately, I've also been generating more working code lately. That's nice when everything works, but when things start going bad, that also means a bigger puzzle to figure out.
This morning, I was working on something I'd started last week. Basically, I'm implementing this thing where you can select an item from a list, and then move it to a different list. You can also do the reverse, should you so choose. Anyhow, I started testing it, and I noticed that it only worked when I moved the item in one direction. The reverse operation just made the item disappear from both lists. Aw, crap.
I fired up the debugger, and started looking through my code. Remember, there was a fresh batch of newly added code, so the mistake could have easily been anywhere in there. I stepped through everything, and it checked out. The item was in the right lists at the right time, but the stupid screen just wouldn't display things properly when I moved items in one direction. No matter what I did, the item just wouldn't show up on the destination side. I'd say that probably took about 30 minutes, and I had nothing.
All right, so I started thinking. Maybe the lists weren't refreshing properly. That's supposed to be something that works automagically (if you absolutely must know, I was setting the ListBox.DataSource & then calling ListBox.DataBind() ). At this point, I was worrying a tad, because anytime you have to mess with the automagic stuff, you're in trouble. Think of it this way - even if you're a mechanic, you expect certain things to just work in your car. The more you have to take things apart, the harder it gets to fix. Same deal here, I was starting to take apart chunks of the engine.
Anyhow, I did some reading & learned how all that stuff works. That gave me some ideas to try, but nothing fixed this disappearing item problem. It kept disappearing on me. So, I now had a bunch of new-found knowledge about the internal workings of some code that Microsoft wrote, but I was out of 90 minutes & my code still didn't work. Oh, and at this point, I was starting to mutter things to myself.
At this point, I resorted to slowly, methodically going through everything one more time. It's the slowest way to work, but if you're methodical about it, you can find the problem by brute force. And, as it turns out, it worked. After another twenty minutes or so, I spotted the problem: when I was moving the item, I didn't tell it what text to display. So, my item was in the right spot all along, but it looked invisible because there was no text there. Going back to the car analogy, that was roughly the equivalent of me complaining that the car wouldn't start when I hadn't filled up the gas tank. It really was that stupid.
After letting out an audible groan & laughing at my own stupidity, I fixed the problem. Frankly, I'm proud of myself for not swearing out loud. Regardless, it took two hours of work, and all sorts of grumbling, but I finally remembered to fill up the tank. Maybe that person who called me retarded was on to something, after all.
Now I just hope that people who end up using this system better like that feature. Otherwise, I'll have admitted to being stupid for no good reason. Well, other than for a laugh or two.
Aren't you supposed to be regression testing the code you commit, so that you don't have these integration issues? =P
ReplyDeleteNone of this was committed into SVN yet, so essentially this amounted to unit testing. That didn't keep me from being stupid, though.
ReplyDelete