I redesigned my blog. I deployed it in a staging environment and it worked fine. When I tried to make the switch on the production server, a few things went wrong. A few things meaning the website went blank. I had no idea what was the problem. I checked the error logs and it was blank. What could have gone wrong?
I enabled the errors but still the page was blank. Nothing was working. This is a small blog, I don't care if it goes down for a whole week. So I made a lot of changes in production but nothing seemed to update, as if I was changing the wrong code base. It took a while to figure out that I had updated some Apache settings, and switched the error log to a different file.
It was frustrating but a very simple mistake. It took me 30 minutes to find the problem to solve it. Debugging is frustrating, and sometimes even Stackoverflow cannot help you because you don't know how to word your problem.
That's the nature of bugs. They are frustrating and you can never predict where they are going to appear. The only way to deal with them is to move your frustration and emotions aside and spend time with them.
I have a hard time understanding when a manager blames a developer for a bug. Bugs are never put in the code on purpose. Creating bugs is not a section in the specs. They just happen.
For the same reason, fixing bugs should be natural process we go through. When you open a page and there is an error. Pressure will only make it harder to fix. If you know that making a mistake is not going to get you fired then you will have one less thing to worry about when looking for the problem.
But there is a mentality that we need to grow out of as developers. A bug is not a bad thing. It's a problem you have to fix. Aren't we problem solvers? So when you discover something is wrong, go through the process of finding it and fixing it.
A friend once told me, "When you open a blank file, there are no bugs. You add them as you start typing." I see a lot of newbies that get mad at the computer, thinking the OS, the language, the environment sucks and is broken. The beauty of code is that it is a reflection of it's author. If there is something wrong, you did that.
Books, the internet, and schools are here to teach you. Debugging is the how you gain experience. A competent programmer is one that has embraced debugging.