free hit counter

Thursday, November 09, 2006

Code inspection would have been faster!

So, I've read the white papers, I've done a 7 week intensive PSP training course, I believe what the experts say about code reviews being faster to find bugs than conventional debugging.

But this morning I spent 3 hours chasing a bug that would likely have been caught in code inspection: I was using the wrong loop index name. dang.

It would have been caught as a compiler error if I were in C++ (do to delcaring the loop index in the for loop) but I'm doing C on a little 8051 with 16kB of code space and 1280 bytes of RAM (yes, bytes).

Another excuse (but an excuse nonetheless): I was having debugger problems, to the tune of semi random crashes of the IDE, necessitating hard power cycle of board and debugger, with a little vitamin reboot on the PC thrown in for good measure. Since the tools have been rock solid up till now, and they're relatively new to me I didn't want to wallpaper over problems, so I ruled out bad hardware, bad USB cables, out of date IDE/debugger software and firmware. Maybe because I was using 1154 of my 1280 RAM bytes? Commenting large blocks of code helped in a similar way that I feel like my car runs better after an oil change.

In the end printf debugging made me actually look at what the hell the code was doing. Why didn't I dash off a hard copy of the code and read it in the first place?

Labels: ,

0 Comments:

Post a Comment

<< Home