diff --git a/debug_tech.md b/debug_tech.md deleted file mode 100644 index 62ab3d4..0000000 --- a/debug_tech.md +++ /dev/null @@ -1,42 +0,0 @@ - -Debugging Techniques - -* read the code -* read the error message (message on bottom, line numbers, type of error on top) -* inspect variables - - print(x) OR Variable explorer in Spyder - - print(type(x)) - - print(x.shape) - - print(x.isna().sum()) - - print(x.info()) -* downsize the input data -* downsize the number of iterations (or similar parameters) -* isolate the bug - - copy the suspicious lines - - comment out parts of the program -* read the documentation -* search on Google/StackOverflow (last of error message) -* execute the code line by line - make small chunks (Jupyter) - blue buttons in Spyder, interactive debugger -* set breakpoints (F12 in Spyder) -* turn it off and on again - - restart the Jupyter kernel -* talk to someone else -* take a break - -3 Main Types of Problems: - -1. SyntaxErrors - Python does not execute code - --> you know there is a problem and roughly where it is - -2. Runtime errors - Python executes some parts of the code - but then it crashes. - --> you know there is a problem - -3. Semantic errors - Python executes the code and does not complain - but the program does not do what it should. - --> you don't know that there is a problem diff --git a/debugging.md b/debugging.md deleted file mode 100644 index 7f961a0..0000000 --- a/debugging.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Debugging - -Debugging your code is a skill of its own. Here is a list of debugging techniques that you might want to try: - -## Easy Bugs - -* read the code -* read the error message -* inspect variables with `print(x)` -* inspect the type of variables with `print(type(x))` - -## Difficult Bugs - -* take a break -* reproduce the bug -* reproduce the bug with minimal input data -* drop assertions in your code -* clean up your code -* write more tests -* explain the problem to someone else -* step through the code in an interactive debugger -* google the error message - -## Very Difficult Bugs - -* sleep over it -* ask for a code review -* write down what the problem is -* draw a formal description of your program logic (flowchart, state diagram -* draw a formal description of your data structure (class diagram, ER-diagram) -* background reading on the library / algorithm you are implementing - - -## Also see: - -* [Debugging Tutorial](https://www.github.com/krother/debugging_tutorial) -* [Kristians Debugging Tutorial Video](https://www.youtube.com/watch?v=04paHt9xG9U) diff --git a/index.rst b/index.rst index e21f263..d71da67 100644 --- a/index.rst +++ b/index.rst @@ -42,7 +42,6 @@ Coding Strategies :maxdepth: 1 writing_code.md - debugging.md coding_style.md refactoring/README.md