+ 42

{For beginners} What to do after you found the bug? [Debugging]

Almost every program generates a bug. And someone great said "Debugging is twice the hard as writing the code", so what happens after finding the bug. These two paragraphs explain what to do after finding the bug. Source: not me; When you find the bug, it is usually obvious how to fix it. But not always. Sometimes what seems to be a bug is really an indication that you don’t understand the program, or there is an error in your algorithm. In these cases, you might have to rethink the algorithm, or adjust your mental model. Take some time away from the computer to think, work through test cases by hand, or draw diagrams to represent the computation. After you fix the bug, don’t just start in making new errors. Take a minute to think about what kind of bug it was, why you made the error, how the error manifested itself, and what you could have done to find it faster. Next time you see something similar, you will be able to find the bug more quickly. Or even better, you will learn to avoid that type of bug for good. Hope it helps you in some extent.

3rd Mar 2017, 2:17 PM
Ram chandra Giri
Ram chandra Giri - avatar
15 Réponses
+ 18
@Luka we can search specifically what type of error caused that whether it be Logic error and maybe some type of exception. But logic error is the hardest in my opinion as compiler and interpreter gives no warnings about them.
3rd Mar 2017, 2:49 PM
Ram chandra Giri
Ram chandra Giri - avatar
+ 8
really helpfull !! 👍👍 will implement in case i got stuck with bugs
3rd Mar 2017, 2:22 PM
sonali
sonali - avatar
+ 3
semprot dengan Baygon
11th Apr 2017, 11:37 PM
pratama
pratama - avatar
+ 2
Well when I find a bug I usually fix it but if its not that big of a deal I might let it slip by
4th Mar 2017, 1:51 AM
Zaakir Hussain
Zaakir Hussain - avatar
+ 2
@luka i have never found an error that i can't find either a direct answer to (google the error code or description) or a path to the solution at least, try searching with an explanation of your problem, there's always a certain group of words that when put in a search query will find a similar problem and advice to fix it, sometimes even rephrasing the same question with a different order of words hits it, worst case come to a forum like this and ask it yourself, youll find info and help the next searcher find it next time
12th Mar 2017, 6:16 AM
William La Flamme
William La Flamme - avatar
+ 1
djh
3rd Mar 2017, 8:25 PM
Xl3YdeR
Xl3YdeR - avatar
+ 1
you're not a programmer until you can fix bug x in a project and produce x^3 bugs with your solution (minimum obviously)
6th Mar 2017, 11:20 AM
William La Flamme
William La Flamme - avatar
+ 1
I try to find the nature of the bug syntax , logical , mathematical and so that it will minimize the search for the bug or flow.
7th Mar 2017, 6:02 AM
Hussain Al-Umran
Hussain Al-Umran - avatar
+ 1
It is difficult to fix a bug in programs that are rooted in the source. Theres an article somewhere describing how when source code is first generated, from scratch, you have no idea where the pitfalls are, so you're going in blind. It helps to hear what you have to say, because I am going in blind, at least at this.
8th Mar 2017, 7:35 AM
Steven Davis
Steven Davis - avatar
+ 1
well, if I find a bug in MY programm, I try to fix it, but if bug isn't in my programm, I try to communicate with developers.
11th Mar 2017, 9:31 AM
Максим Корытко
Максим Корытко - avatar
+ 1
minimizing the flows and bugs even if that will not effect the results for now is a preventive habit from a security breach and will give the programmer new ways to use later with less debugging and Hassel.
12th Mar 2017, 6:06 AM
Hussain Al-Umran
Hussain Al-Umran - avatar