The Programmer’s cat: My technique of debugging

Nobody likes bugs and programmers especially hate bugs. Therefore, one of the first lessons I study when I started programming is how to debug the code. I name the technique “The programmer’s cat”. And to understand it, you first need to do the steps follow.

Step 1: Slice down your problem

Ever feel overwhelmed when you receive a huge project with over 20 websites, all database driven with a dozen of database tables to take care of. Don’t be, take a deep breath and divided your big projects into a smaller chunk of tasks and suddenly it feels easier, right? Then, you will conquer them one by one. Your head is easy to fool when you finish a small task, keep telling yourself “We are almost there” and eventually you will be there in no time. By that way, you are also facing less stress and thus, writing clearer codes and fewer bugs

Cheat your mind by keep feeding it with small tasks until the big projects get done
Image source: https://clickleo.com/problem-solving-using-copy/

Step 2: 1 minute coding, 3 minutes testing

Take one baby step at a time, testing every line of code you write thoroughly. Do not wait till the end then do the testing because you will be lost in a maze just to find a missing tiny tiny semicolon. Check your direction frequently and thoroughly so you can get ahead. And one more thing, don’t forget to leave a little bread-crumb trail along the way with comments between a numerous line of codes so you can always find the way out when you are getting lost.

Programmer problems: The lost semicolon. Tech Meme for Meme Monday!

Don’t wander around the jungle just to find a tiny semi-colon
Image source: https://www.pinterest.com/pin/559783428655367005/?lp=true

Step 3: The programer’s cat

All these steps lead us to the technique I call “The Programer’s cat”.

Unlike the famous physicist Schrodinger, who was unsure whether his cat is alive or not, we the programmer can confirm our cat (in this our cat is our code) is working or not at a specific given time. Then we can turn back the time to undo the bug which killed our cat. Feel like a superhero, huh? For example, if you sliced down the problem to part 1, part 2, part 3 and do careful and thorough testings for each part then when a bug comes, you can be sure that the broken pieces must come from part 4. That will narrow down the search, making the process a lot faster. To compare now you don’t have to find a semicolon in the middle of the jungle anymore, you just need to find a broken branch in a specific tree and chop it off.

programmer  cat ignoring mouse

Hope this cat is not missing a semicolon in his code
Image source: http://nlfunnyvideos.com/fun/programmer-cat-ignoring-mouse-funny/

I hope the technique above will help you guy a lot as it helps me in finding the bugs. Stay tuned for more sharing from me the next time.

2 thoughts on “The Programmer’s cat: My technique of debugging

  1. Pingback: Never say no to new opportunity: My story of Global Game Jam 2020 – Paul Tran

  2. Pingback: How to install a login system in ASP.Net – Paul Tran Design

Leave a Reply

Your email address will not be published. Required fields are marked *