How not to manage code

I’m a systems guy. The reason I’m a systems guy is because I’m not a fan of long periods of coding. If I was, I’d be a developer.

So anyway, I *do* write code, and I maintain a Moodle course management deployment. We needed some local customizations made to the code, and I even wrote a whole new module for the app, and it’s been a much nicer system to work with than the home-grown monstrosity it replaced. However, after maintaining it for about a year now (on and off, as needed, as bugs arise, etc) I’ve learned something really important to the stability of home grown code. As is the case with all things in life, it comes down to “know thyself”, and after some recent code updates, I’ve learned more about myself, and as a result can make the production app more stable. What did I learn?

My brain will keep going even though it’s tired and weary and doing things that any wide-awake person would look at and say “dude, what the hell are you doing?”

Perfect example: I implemented a feature in Moodle that allows professors to sort by “username” instead of just first name or last name. I did this just the other night, at some time dangerously close to midnight. I opened a local copy of the site, went to the page, and thought “yay! there are my usernames!”. Then I clicked one of the sorting arrows and said “yay! They’re in alphabetical order!” Then I said “ok, time for bed before I fall over onto the keyboard.”

I know what you’re thinking. “Surely you revisited this; surely you, like any reasonable developer, did some more testing than just *that* before pushing it out to the test site and letting users play with it.” I didn’t. I never thought about that code again. The next day I implemented one or two other changes unrelated to this code, and went on my merry way. I pushed the code out to the test site yesterday, told my primary testing user about it, and got an email back that was just embarrassing. “Um. Yeah. It only sorts properly if you sort ascending.”

Oh man.

Yeah, so don’t do that. If you write code late at night, write yourself an email just before you go to bed reminding yourself to test that code s’more before it goes anywhere. It’ll save you some email, and a good bit of embarrassment.

Happy Friday.

Technorati Tags: , , , , , , , ,