May 05, 2005

Code completed

I've realize this week, my little summer vacation, that school takes up a lot of my energy. Freed from the burden of homework and studying, I was able to spend time doing some recreational reading.

I finally finished Code Complete. I started it nearly a year ago. (Hey, it's a big book and things come up.) At least i can honestly say i read every page of that book. It felt like i also learned something on every page as well. Well, maybe it wasn't so much learning new things as it was generally rounding out my knowledge of the software construction. It's nice to read research that agrees with things you believe. The book is also a great source of inspiration. Jack said he tried to pick it up every year to see if he can get something new out of it. If i were to attempt the same feat, at my current pace, i would be perpetually reading the thing. Actually, that's probably a good idea.

Toward the end of the book was a chapter on debugging. This is a task i've had to do every since i wrote my first line of code that didn't work as expected. I've always just did it without ever realizing what i was doing which it made it hard to explain to others what to do. Steve McConnell, the author, describes the debugging process in terms of the scientific method. Once a programmer finds an error, he must make a hypothesis as to what might be causing the error. Then, he must perform an experiment to see if the hypothesis holds up. Once the exact cause is know, it can then be fixed. I've seen programmers that try to fix without completely understanding what's wrong. This coincides with a post at the SQL Team weblog about being able to identify and simplify the problem. It's also a good idea to start small with your hypothesis. If you're quick to think that "the computer is messing up" or that the .NET framework must have a bug before thinking it might be your own code, that's also a problem. I think that finding and fixing the problem aren't nearly as important as understanding how the error came up in the first place.

Posted by Matthew at May 5, 2005 10:49 PM
Comments