Studio: Strategic Debugging
At this point, we have seen a lot of different types of errors.
We have possibly created logic errors or syntax errors and now, we have just learned about the
The goal of this studio is for us to develop strategies for debugging so that we can get rid of the bugs and get back to coding!
Think of a bug you have seen in your code. This could be the time you dropped a keyword when initializing a variable or misused a method.
- Take some time to discuss with the group what your error was and how you solved it.
- Did you talk to a TA to get it?
- Did you find a great resource online that was helpful?
Your TA will go over the pros and cons of different resources that can help you resolve the error. You will then go over a general strategy to start debugging your errors.
Your TA will go over this process with you and how it could help you debug more strategically. This process reflects what we have found works best for us and many students, however, as you grow as a programmer, you may find something works better for you. That is fine! Every programmer has their own process for debugging based off of their experiences and how their mind works.
- Check the stacktrace to read the error message and see where it occurred.
- If you see the error, fix it on that line and recompile.
- If you cannot see the error, Google the error message.
- Check any relevant StackOverflow posts in the results.
- If the error is related to built-in methods or objects, also search for those in the official documentation.
- If the error is related to something that cannot be done in that particular language, look at the responses to each comment before trying to replicate proposed solutions. Solutions can oftentimes go out of date and responses will tell you if that is the case or simply if it is a bad solution.