# Debugging
Debugging is a part of [[Programming]]. It uses tools like a [[Debugger]] and [[Profiler]], a [[REPL]] or [[Javascript console]], [[Chrome Devtools]] to try to pinpoint why an error might have happened in a program.
- [[DRAFT - 2022-06-01 - Debugging techniques 1]]
## Techniques
- Write [[Unit tests]] or scripts to reproduce and validate the bug
- [[Rubberducking]]
- [[ZK - 4a2c - Rubberduck with yourself through writing and speaking]]
- Documenting the bug, because [[ZK - 4a2a - Writing is thinking]] (this is different than the [[Rubberducking]] through writing mentioned above)
- [[Logging]]
- Tooling
- [[Time travelling debugger]]
- Adding assertions about [[Sofware Invariants]], and potentially trying to prove why they should be true (see [[Mathematical Proofs]])
- [[Sound-based debugging]]
- Here is a page about how to create a paired down application for [[Bug Reporting]], which is an important part of [[Debugging]], and [[Questions]]
- [Short, Self Contained, Correct Example](http://sscce.org)
After the debugging session:
- make sure you have a [[Unit tests|Unit test]] that validates that your bugfix actually fixes the bug
- potentially [[ZK - 2a2a16a - Use type systems to make it impossible to create invalid state]] to ensure the bug never happens in the future
- do a write up of the debugging session and thinking both for personal reference, and for [[Software Mentorship]]. It is also useful as [[Software Documentation]] for potentially non-intuitive tests or statements.
## Ideas
- Record debugging sessions with [[asciinema]] and [[PROJ - Raza - keep history forever]], publish for reference
## Links
- [[SK - 2f0 - 2022-06-01 - List of debugging tips]]