I’ve been in debugging hell for a few days. I’ve had a few nightmare bugs, and learned a few things, as well as having my indie ass saved by some lucky stuff. here is the summary:
I had a bug that was a critical, game-ruining crash thing. When I debugged it, I found the exact line of code that was causing it. I had removed a certain if() statement. I remember doing it about two weeks ago. Can I remember why? Can I hell. IF I had proper comments in the code where I changed stuff, I would have worked out what was going on. IF I had forced myself to check in more regularly and ALWAYS type detailed comments into the check-in softwares submission dialog, I would have worked out what was going on.
Luckily, it wasn’t a disaster, because a long time ago, I clearly made a decision to include my ‘design log’ in the checked-in source-controlled files. This is a long rambling document where I always type everything I’m doing, and have my list of motivating ‘**DONE**’ statements for each day. Naturally, when I made that code change roughly two weks ago, I had written about the problem that needed me to do so. Normally, finding this comment would be a pain, because there are no date stamps on the log, and I wasn’t sure what I was looking for. Hurrah! the design log also has a changelist, and I found the bit I wanted just by seeing the changes made to it in the same check-in as the code change itself.
Lesson: Keep a log of your work, and source-control it. Adding better comments to code doesn’t hurt either.
Anyway… Microsoft Security Essentials is apparently ‘teh awesome’ because it not only killed the virus, it restored every one of my files to their original state without problems. And it’s free. How awesome is that?
One thing I did do, as a precaution after all this (apart from keep MSE installed and running several deep scans overnight with 3 different scanners) is to create a truecrypt container and stick a copy of my website inside it. There is no chance of some virus cracking that open and ruining those files (although in theory it could delete the container). I also keep backups of vital stuff on a thumb drive, just in case. Scary stuff though. Especially because I’m not exactly some dork who accepts .exe files on IRC or opens random email attachments. This stuff is getting harder and harder to avoid.