Hey! How's it going, assuming everything's fine. So debugging is a very important part if you are a software engineer but apart from that it is also important in life as well.
Helps you understand things clearly
So let's dive straight into it.
- Don’t Trash your CODE!
- Read the error Message!
- Don’t Waste time on the impossible! (or at least the improbable)
- When in doubt, print more out
- Take it one step at a time, and print it out
This points are pretty self explanatory, but still I'll share my explanation as well, Read further to understand in detail.
Don't Trash your CODE!
- I used to do this every time I ran into some error or bug, CTRL+A -> DEL baam just trashed it and started from scratch.
- But eventually It was consuming a lot of time and efforts which was not supposed to be needed in those kind of bugs/error.
- So clearly this was not an effective approach for better understanding as well as to become a better software engineer.
- Instead if we just try to figure out what exactly go wrong, or try commenting out some of complex code blocks, which also leads to our next point.
Read the error Message!
- Read whatever the error message out loud multiple times, so that is get's clear in your head.
- I know that error messages are so long and really nerve wracking but still if we make a little effort of reading it out, we might get the solution in the error message itself, which technically most of the time we'll get our solutions from error itself.
- But what's not cool is that reading the error message in a hurry and wasting your time and effort in searching the wrong place because you misinterpreted the error.
Don’t Waste time on the impossible! (or at least the improbable)
- If you take too much of time spending on fixing a bug/error which takes too lot of effort and time then just shut down your computer/laptop and go for a nice walk or listen to a song or do anything except stressing out your mind.
- And then come back and try to solve it, most of the problems gets solved in just a minute or so.
- If you still didn't solved it then try reaching out to your senior/stack overflow/google.
When in doubt, print more out
- Simple, As it says when you are in doubt, print out more, because if you don't even know what's happening behind the scenes then how to do expect to solve any of your errors.
- You might get an empty array printed out which you were using before to get the values inside the array.
Take it one step at a time, and print it out
- And last but not the least, Go slow, Doesn't matter what is the speed of other developers compared to you. They might be fast but if you copy them then instead of cutting time you'll extend your time and effort X2.
- Hence, like I said in the last point print more out, It'll easily solve your problems.
Being a software engineer your work is to make things easier not to make things complicated.
VISHWAS ACHARYA 😉