Debugging - Team1100/CodeExamples GitHub Wiki

Nothing personal

That's right, boys, I have an image.

Debugging; everyone's favorite part of programming. For those unfamiliar with the term, or for the contingency that language has evolved since my time and it's now referred to as something else, debugging the process of removing compiler and run-time errors from your code.

I have a compiler error!

You're in luck pal friend chum buddy associate companion ally colleague mate fellow amigo, this is the one that's generally easier to fix. The first step is to always google the error. More often than not, I forget this, and spend a few minutes faffing about before remembering that there is a better way. Once you've google'd it, I can't help you, as it really becomes a case by case basis. Good sites to watch out for are StackOverflow and ChiefDelphi.

I have a run-time error!

Well, looks like you have quite the problem on your hands. Run-time errors are more general. It's an error with what your code is supposed to do; like the pistons firing out of sequence or the robot driving backwards when it shouldn't. Even if it's been 4000 years since I wrote this, I am certain SmartDashboard will look incredibly similar to the way it does today. Start the robot in test mode and drive actuators one at a time until one causes a problem. If it's not something with an actuator, add System.err.println(); statements in parts of the code that are dubiously functional. Use them to gauge where the execution pointer is at any given time.