5 ms·
The short answer is: You can’t. But you can try. Try doing the following to reduce bugs: 1.Write a lot of unit test cases covering all know scenarios that you
by samikc 15y ago
The short answer is: You can’t. But you can try.
Try doing the following to reduce bugs:
1.Write a lot of unit test cases covering all know scenarios that you have in your spec or mind. This only assures that there are no bugs in your set of test cases, however there could be bugs lying out side your test case set.
2.Before changing your code check if you have test cases written for the code. If not do step 1.
3.Have good logging for your code in action. If a bug is found later it will help you to root cause it.
4.If you are in object oriented programming try to replace if else codes with polymorphism. Its difficult but if you can it will either reduce logical bugs or help you find them quickly as they unfold.
5.Test for all if and else conditions. All if condition with complex logical arguments (using AND / OR) must be checked for all conditions.
6.Learn from your mistakes in coding and try not to repeat them.
That said, its easier said than done. I would follow this thread how other suggests and learn.