Update
This commit is contained in:
parent
5604db85d2
commit
d8f1711fa8
33 changed files with 2096 additions and 2036 deletions
|
@ -4,7 +4,7 @@ Debugging is a term predominantly related to [computer](computer.md) [technology
|
|||
|
||||
[Fun](fun.md) fact: the term *debugging* allegedly comes from the old times when it meant LITERALLY getting rid of bugs that broke computers by getting stuck in the relays.
|
||||
|
||||
**Spare yourself debugging by testing as you go** -- while programming it's best to at least quickly test the program is working after each small step change you make. Actually you should be writing **[automatic tests](automatic_test.md)** along with your main program that quickly tests that all you've programmed so far still works (see also [regression](regression.md)). This way you discover a bug early and you know it's in the part you just changed so you find it and fix it quickly. If you don't do this and just write the whole program before even running it, your program will just crash and you won't have a clue why -- at this point you most likely have SEVERAL bugs working together and so even finding one or two of them will still leave your program crashing -- this situation is so shitty that the time you saved earlier won't nearly be worth it.
|
||||
**Spare yourself debugging by [testing](testing.md) as you go** -- habitual part of the programming routine should be at least briefly testing the program after each small change added. Actually you should be writing **[automatic tests](automatic_test.md)** along with your main program that quickly tests that all you've programmed so far still works (see also [regression](regression.md)). This way you get to uncover a bug early and you know it's caused by the change you just made so you find it and fix it easily. If you don't do this and just write the whole program before even running it, your program will just crash and you won't have a clue why -- at this point you most likely have SEVERAL bugs working together and so even finding one or two of them will still leave your program crashing -- this situation is so shitty that the time you saved earlier won't nearly be worth it.
|
||||
|
||||
**Which kind of bug is the biggest pain in the ass to debug?** One take on answering this might the following: [statistical](statistics.md) bugs. That is bugs that aren't really an error in the code but an error in the mathematical model behind the code, and furthermore ones that don't manifest in a single place but only in the whole. For example when programming a [monte carlo](monte_carlo.md) [chess](chess.md) engine -- the code may be perfect, it's doing exactly what you want it to do, but the engine is making wrong moves because you actually want the wrong thing; debuggers won't help you, you cannot point a finger at a specific line in the code, you have to think deeply about statistics, sampling, probabilities and things that many times betray intuition, your brain starts to emit smoke and only then you realize you actually chose a wrong mathematical model and have to rewrite the whole thing. This is debugging on a high level.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue