Saturday, July 2, 2011

Debuggers are Great!

Many beginning programmers, and even some more advanced programmers, have yet to discover the incredible tool that is a debugger. I too am guilty of waiting far too long to learn how to use one. Although simple printf/cout "debugging" may work for some smaller projects, it is far from ideal. It takes time to type out individual cases, it clutters the code, and it takes a much longer time to track down where difficult problems are arising. This is especially true with memory errors, where it is unclear what is happening to the memory and where. Debuggers really shine here, and replacing text output with a true debugger dramatically improves the speed in which issues can be fixed. Useful features included with most debuggers are the ability to step through the program line by line, add breakpoints before code gets executed, and output the contents of any variable currently in scope. It takes everything one could do using printf/cout and then some. So why don't more beginners use them? Being a novice programmer myself, I can say that the debugging interface can be quite daunting at first. Setting up a project for debugging can also be difficult if one is not familiar with all the flags that need to be set. I recommend anyone who is not comfortable with a debugger follow a tutorial, and you may soon find that the debugger is not as hard to use as it looks. Even if you do not have a program that needs debugging it is a good idea to get familiar with the interface, as every programmer will need to use it at some point. You might as well get comfortable with it now, rather than trying to learn it while being frustrated by a tricky bug. There's my ramblings for the day, if you haven't already, give a debugger a try!

PS. I still don't feel very good at blogging yet, but hopefully if I continue then my posts will get better =).

No comments:

Post a Comment