When I first started programming, a bug was an indication that something was wrong with the code.  While this is still true, I now look at bugs a different way.  I pretty much take a “glass half full” attitude towards them.

A bug is an opportunity to make your software better.  Instead of asking: “How could this happen? Who made this mistake?”, rather say: “What can we do to make our system more robust or safe so this doesn’t happen in the future”.  Sometimes it’s a code fix and sometimes a process fix.  But either way, finding a bug is an opportunity to improve in some way.

This attitude avoids the “quick and dirty fixes” and reduces occurrences of future bugs of the same type.  It lets you focus on other areas that need work resulting in better, more stable software.

So next time you get a bug, try asking yourself “What can I do so that I handle this type of thing better in the future”?

You’ll find that you actually get excited when things break because you’ll see it as an opportunity for improvement rather than evidence of a mistake.