My debugging and bug prevention strategies
Programmers, such as myself, frequently encounter bugs in our program code. Sometimes, we are able to resolve them quickly, sometimes it take hours. Worse still, after resolving the current set of bugs, another pops up! As a programmer, I have experienced the pain of debugging my program code, for hours on end, not knowing what is wrong with my logic. Over time, I have developed a debugging toolbox that has proven to be effective for myself. I have to mention though, that this only applies to Competitive Programming, not professional programming, where circumstances could vary greatly. Another point to note is, my discussion is more skewed towards C++ programmers so issues like segmentation fault may not apply to languages such as Java. The 5 most common bugs/errors that I have seen are (in no particular order): 1. Segmentation fault. 2. Integer overflow 3. Division by zero 4. Strange output values with multiple test cases 5. Logic Errors No. 1 is mostly easy to