Lesson 4
Repeated Practice Makes Perfect
Chapter 8: Debugging your code
Debugging your code
Phew. I think you have exercised your brain a lot already in this lesson.
I will try to keep the remainder of the lesson lightweight!
Now, hopefully you have been testing and debugging as you write your codes, haven’t you? :)
Of course, even while you test as you code, you will inevitably encounter some errors. Or bugs. 🐞
As discussed back in Lesson 1, never panic when you encounter errors, or if your code does not work as expected. It just means that you have somehow introduced a bug somewhere (you are human after all!) Your job now is to exterminate the bug (debug) before it causes any further damage! 🐛🐛🐛
You will need to do this systematically though, and not just wildly guess. Locate exactly where the problem is, and correct the problem. Be a proper detective! 🕵️
Also, do not just aimlessly rerun and rerun your code without doing anything and hope that the problem will fix itself. “Insanity is doing the same thing over and over again and expecting different results” (a quote from the novel “Sudden Death”, by Rita Mae Brown).