Tips for debugging

College computer science
By Evan S.

Nothing is working - what do you do next?

When you are working on a project or idea that has never been done before, you will likely find yourself in situations where your robot or code is simply not working. If you're anything like me, this can also happen with projects that are well documented. 

Inexperienced debuggers often assign what is working to the supernatural and take the approach of simply not touching anything once its working. Here, I am going to walk you through a general outline of my debugging process, which will hopefully teach you the skills to get yourself unstuck in your code.  

Step 1: break the problem down to its most simple steps.

When chasing the big picture goal of getting your project working, it can become overwhelming to find your minicar is driving much slower than intended. To counteract this, it is crucial to break the problem down into simple steps. In the example of the wonky car, this could look like testing your motor independently from the rest of the vehicle to make sure it is spinning correctly. Then, when you add it back into the vehicle and notice it is no longer spinning at the same rate, you can hone in on the problem that the axel is rubbing against the frame of your car and preventing it from spinning properly. For every problem, there are countless subtasks that build up to create it. So do a little brainstorming, think of possible reasons why, and find isolated tests to prove that these individual components are functioning correctly. 

Step 2: write down what you are doing.

Once you have done all that work brainstorming possible causes, write them down! Make sure you also write down your solution to how you isolated the problem and what the results of your testing were. A white board or notebook are your best friend when debugging. Keeping track of consistent proven ways to solve certain problems is so critical when working on a project. You know what's worse than your project not working for the first time? Your project not working for a reason you’ve seen before but don’t remember how you previously solved it. Having everything written down also makes it easier to get help when you show your peer, coworker, mentor, boss, or teacher what you have done so far.  

Step 3: ask for help.

I've never seen someone complete a project in a vacuum. Check in with other people along the journey. This can incentivize you to keep working and will often help get you out of a rut. That being said, don't give up as soon as you encounter a problem. As annoying as this may sound, struggling through a problem is where all the learning happens. Don’t be afraid when you mess things up by trying to understand them better. At the end of the day, that's what engineering is all about.  

Evan graduated with distinction from Yale with a degree in Electrical Engineering and Computer Science. He is now working for a space grade semiconductor company in Boston.

Related Content

College

Did you know we offer tutoring for college students?

Learn more

Comments