Developing software is all about writing code and making changes.
1) the changes affect/break other things in unforeseeable ways
2) the changes are misunderstood and implemented incorrectly
3) the programmer just plain makes a mistake
Nearly all software bugs are a result of one of these 3 causes.
Class 1) bugs are nearly unpreventable and are a function of the software's complexity. This increases with every new feature and custom branch.
Class 2) bugs are 100% preventable. I spend a lot of my time on both ends (clients and developers) trying to clarify and organize communication.
Class 3) bugs are sometimes preventable. This is where we do analysis and prevention, aiming not make the same (or similar) mistake twice.
I work on preventing Class 2) bugs by improving communication and tracking via PMRobot.
When a Class 3) mistake is made, we analyze why and determine whether there is a cost effective way to prevent it from happening again.
When Class 1) bugs happen, we analyze the root cause, then try to refactor, reduce complexity, or add more automated testing to reduce the likelihood of a recurrence.
We learn everything we can from Class 1) bugs, but in mature, complicated software, it's sometimes better to fix the problem quickly and cleanly, and move on.
When it comes to bug fixing (and life), time is often better spent focusing on the things you can control, rather than what you cannot.