Essentially, no but you should do your best anyway.
I'll explain why (or just skip to the conclusion if you don't have enough patience)
Consider a problem as trivial as the implementation of binary search. One very popular implementation had a bug that went undetected for around two decades. If twenty lines take twenty years to get bug-free being widely used and even supposedly proven correct, can we really expect a huge program to be bug-free?
How many bugs can we expect a huge program to have anyway? One number I found was "10 defects per 1000 lines" (Code Complete 2nd edition, page 517 - merely used an example, not quoting any data)
That gives us around 200 000 to 300 000 bugs in your software.
Fortunately, we have ways to improve the quality of the program. Unit testing, code reviews and ordinary manual testing are known to reduce the number of bugs. Still, the number will still be high.
If we could solve 95% of all bugs that'd be incredible. And yet we'd still have 10 000 to 15 000 bugs in the software.
Fortunately, since the software is widely used (and, therefore, widely tested) bugs are going to be found. So we'll gradually get fewer bugs.
However, fewer bugs also mean that the remaining ones are harder to find - so don't expect a linear curve in bug fixing. The last few bugs will be really tricky to find and could escape detection for several years (assuming they are ever found).
You also seem to be mistakenly assuming that if the software doesn't change, no new bugs are going to appear. If the software depends on third party libraries, new versions may break some features - introducing new bugs even though the code of the application is still the same. New operating systems can also break an application that previously worked perfectly (see Windows Vista for a popular example). Consider also compiler bugs, etc.
It is unclear whether code proof tools can truly solve the problem of buggy software. It is certainly not possible to solve the halting problem for any program, but it might be possible to prove that a program behaves as specified... But then what? Maybe the proof program has a bug. Maybe the specification itself has a bug.
So clearly, we can greatly reduce the number of bugs, but it's really unlikely we'll ever get to zero.
Because there is some notion that every fix you make creates more
bugs, but I don't think that's true.
(emphasis added)
You are correct. This statement is wrong. Here's an example:
int main() {
int x[10];
x[10] = 8; //Buffer overflow here
return 0;
}
Now, let's fix this bug:
int main() {
int x[11];
x[10] = 8; //No buffer overflow here
return 0;
}
See? We fixed a bug and introduced no new ones.
However, it is certainly correct that every time you fix a bug you risk creating a new one, though this risk can be mitigated (e.g. with unit testing).
Let's say that for every 100 bugs that I fix, I accidentally introduce a new one.
So if I fix 10 000 bugs, I introduce 100 new bugs. And if I fix those new bugs, I introduce one bug. But so what? The program now has 9 999 fewer bugs, so it's probably better than it was (assuming the new bug is not 10 000 times worst than the previous ones).
Also, fixing a bug can expose new ones. But those bugs can be fixed as well. If you do things right, eventually the software will be in a better state than it started in.
I was old by a few top programmers that it's better not to fix a lot
of bugs because of the notion I mentioned in the OP.
This behavior is negligent. If there's a bug and you can fix it. Do it. Of course you should do your best to prevent adding new ones but if I introduce one small bug for every 10 serious bugs I fix, that is not a valid reason to stop fixing bugs. In fact, it is a good reason to keep fixing bugs.
So less bugs you
fix, less bugs will come back at you in the future
The fewer bugs you fix, the more bugs will remain in your software, annoying your users.
Indeed, they won't "come back at you in the future". They won't come back because they never left in the first place.
The notion of "come back" is related to regressions. Again, it is possible to reduce the risk of regressions.
Some bugs can't be fixed because they became so widely used that people started to depend on them and fixing the bug would break the program for those users. It happens. However, can they really be considered bugs in that case?
The "fix a bug, make a bug" mentality might be related to That Horrible Monster - code that is so unreadable and unmaintainable that merely touching it creates bugs. If you have a monster in your code base, you might first need to un-monsterify it before getting anything done.
Finally, if you are a terrible programmer, there's the risk that anything you touch creates new bugs. This would obviously make senior programmers nervous. However, saying "Don't do anything. Don't touch anything. Don't even breath." is probably not the right way to create a healthy work environment. Education is better.
Conclusion:
- Software that keeps getting tons of new features but no bug fixes will inevitably suck.
- Software that gets a moderate number of new features but gets its bugs fixed has a better chance of being usable.
- Those who try to have few bugs have (on average) fewer bugs than those who do not care.
- It is not reasonable to expect a program to eventually become bug-free.
- Senior programmers are not necessarily competent.
- Fix your bugs.
- Adopt methodologies that improve the quality of your software.