May 27

Debugging Others’ Code

Category: life, realbasic

In programming, a lot of writing code isn’t actually writing code.  A lot of programming is either finding code and using it as a reference, or finding code and just copying it to your program with slight modifications.  This saves programmers time and effort.  Why rewrite code?  However, sometimes code needs to be written because no reference can be found.  For large projects, this is often done in groups.  Which brings about an interesting problem: debugging other people’s code.

Ask any programmer what they hate most about programming and the answer will most likely be debugging.  Finding what’s wrong with code you wrote is the worst.  Because, in your mind, nothing’s wrong with it.  Why would you write code wrong the first time?  Often, the easiest way to debug is to wait a little while between coding and debugging, and taking a fresh look over your code.  So, this would mean that debugging other people’s code is easier.

Recently, I’ve had to go through the process of debugging someone else’s code.  My church uses the program OpenSong to display lyrics on a projector.  It’s a nice, free, open-source program that works great most of the time.  However, it isn’t without problems.  So, as part of the ongoing church-improvement project, we bought a REALbasic license, and I’ve been going through learning.  My method of learning has been fixing bugs in OpenSong.  This has proved a great way to learn because I have to practically go through each line of code and think, “OK, what does this do?”

And, as proof of my GUIEncode program, this technique has worked.  That being said, I also did a lot of learning by writing the GUIEncode program, but that’s beside the point.  I have found it really easy to fix bugs in OpenSong, even though I am new to REALbasic.  Why?  Well, first of all, REALbasic comes with a great debugger.  All the tools necessary to go through code line by line are provided.  More importantly, however, I don’t know what the code is expected to do.  I look at the code, see what it does do, think what I want it to do, and make changes that will hopefully fix this.

That’s how debugging should be done.  Not by someone on the inside, but someone new to the project.  They are much more likely to find errors the first time.  So, from first hand experience, while it may sound harder, debugging other people’s code is actually easier!  Who knew?

No Comments

Leave a comment