Blog Post #4: Getting Unstuck

Sometimes when I am stuck with a problem, it takes me hours to find the solution and make progress. I have found that this is because sometimes I develop “tunnel vision”, and I focus on the small part of the problem, instead of stepping back and looking at the big picture.

Going back to the beginning of a problem, and thinking it in a new way usually saves me a lot of time in the long run when solving a problem I am stuck on. I suspect this is because when I am too focused on a specific part of the problem, the key to solving the problem may be further back in the thought process, and spending too much time on one part usually results in a lot of lost time. A good example would be when after running code, an error pops up that says that you are trying to unpack an object that has a type of “None”. The error may have be present at the end of the code, but the cause of the error is most likely higher up in the code base. Focusing solely on the line that is unpacking the object will result in a lot of lost time, so it is important to find the root cause of the problem, and this can be aided with the use of debugging.

Debugging is a tool that I have used many times throughout my learning experience as a computer science student, and I have come to enjoy the process. Some methods I use to debug are using the in built debugger on IDEs such as VSCode, which are really helpful in keeping track of all the variables and stepping through the code. This ends up saving a lot of time and really appreciate the effectiveness of this tool to find bugs. Another method I use if an inbuilt debugger is not available are print statements. Printing the result of a variable to check if it matches what the output should be is also an efficient way to catch errors.

Print Friendly, PDF & Email

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *