When I started my journey as a computer science student years ago, I had very little knowledge of anything programming related. I wasn’t prepared at all for debugging, which is actually a crucial part of programming. Debugging is the process of finding and fixing bugs (errors) in code. There are various errors that can occur. Most of my program bugs are due to statements being typed incorrectly, for example. I may be biased, but I think the process is actually kind of interesting.
There are a lot of tools/methods used to debug. A simple one would be paying attention to error messages printed after running a program. A debugger is a tool used to identify and fix bugs. You run your program within the debugger, and this allows you to monitor what your program does so you can see the exact line where the error occurs.
I personally like using debuggers because I can watch the values of different variables change as I go through the program. Sometimes, it’s not easy/possible to use a debugger and I just end up slowly going through each line of my program and making sure my logic is correct. This is often easier said than done.
When a program doesn’t work like you want it to, it can be extremely frustrating, especially when you have no idea what’s causing the problem. Just last week, I was debugging code for one of my classes and it took me two days to figure out what the problem was. It ended up being a simple fix and I just had to change one line of code.
The reason I have mixed feelings about debugging is because as you can imagine, it can be a really long process. But it is somewhat comforting to know that I’ll eventually find the source of the problem and be able to fix it. At the end of the process, it’s extremely satisfying to know that you’ve solved a problem you once thought you might never find the answer to. Which, funnily enough, is a really good part of life too.