Think about the practical consequences of a bug as compared to all the other problems that need solving.
Consider the following consequences of creating a poorly written piece of code:
- Entire database gets dumped every other month. 48 hours of downtime while the backups are restored.
- Customer records get cross-linked. $200 worth of orders get shipped to the wrong customers per month.
- A order gets stuck in a wrong status once a week. Order ships but warehouse to has to call helpdesk every time it happens.
- Once very two weeks or so, the app crashes and user has to re-enter 2 minutes worth of data.
- Once a month, the app hangs on startup. User has to kill process and start over.
The first one is obviously unacceptable. #2 - #5 may or may not be, depending on the nature of the business. #2 - #5 need to evaluated in the context of other problems the business is facing.
Ideally, #2 - #5 would never, ever happen. In real life, with conflicting priorities, the people signing your paycheck might want you to be working on other things rather than writing perfect code that never, ever has a problem. They aren't going to be impressed if #5 gets fixed at the expense of not fixing a more serious bug in another program.