"It is every programmer's nightmare and hidden guilty pleasure; the bug that lies in our code, lurking and chipping away at the expected output of our program." excerpts from ermmm….me!
Oh, Damn Bugs!!!
Inasmuch as we feel so devastated, frustrated and tired when it comes to fixing bugs in our code, there is this joy and excitement we get when we progress from one bug to another.
"Oh yes, a different error message finally!"
However, there are these stubborn invisible bugs that spend their days in hiding from our physical eyes, usually undetectable at first glance and sometimes staying hidden for days.
That little displacement of an "s" in names or just something altogether minute could frustrate and drive a 40-year-old man to tears.
Okay, let me tell you a quick story……..
Ever since the first day I picked up coding and wrote my first "hello world" on my terminal, I had never used the Python debugger. Whenever it came down to running my code, I always chose to run without debugging.
Didn't even know what it felt like to debug a code because, in my opinion, it was a waste of my precious time.
Fast forward to University, I took this particular course that required the application of Python. In every single class, this lecturer made it his mandate to instruct us to run the Python debugger instead of a simple run process.
And as usual, I always ignored him and felt he was just trying to stress us, fulfill all righteousness and follow protocols—because why go through all that process when I can just click on run?
Until one fateful day……
I was watching a slide he posted about building Venn diagrams with Python, and I was getting this bug. Then came the vivid flashbacks from his class where his oval-shaped mouth mouthed the words "Use the Python debugger to run your code students."
So ladies and gentlemen, for the first time in my life I used the Python debugger, and that there was the best decision I made in my Python journey.
You see, when I started coding I had nobody to lecture me on the importance of this tool, even tutorials I took never made mention of it until I had my first encounter with it, and I kid you not it was the game changer.
I clicked on it after decorating all lines of my code with those red-shaped dots, and in 10 seconds I could see the powerful and magical nature of the Python debugger.
This debugger showed me line by line what was happening in my code.
Pause…..*
Let's reiterate a bit…..
Using the run statement normally automatically runs your code at a stretch and crashes immediately it encounters a bug or an error.
Well not my lovely debugging tool, this tool walked me through every line of my code and displayed the result for each line of code, showing me what was going on in each line. It was a very emotional moment for me people, because in those moments, it felt like we were best of friends…sniffs*
This on its own simplified my code and made it easier to locate my bugs, and since then I never ran my Python code without my best friend-debugger.
I do not however promise it will solve all your bug issues, but what I do promise is that it will always give you a head start on how to go about solving them.
So ladies and gentlemen, use that debugging tool today!