A bit of a diary post but I realised today that I need to stop focusing on results only and enjoy the debugging journey.
I suppose we all know this: You're coding and you've just written a few extra lines, suddenly your app crashes, nothing loads and you have this big fat error, warning, or nothing at all. Oops.
I used to see this as a failure, as my code not being good enough. It's important to realise that's not what it is.
It's a learning opportunity.
"But how do I make sure that I don't lose too much time on this?"
This was one of my big questions. I'm straight outta bootcamp and I am a junior so it's bound to happen a lot. Here is what I think can help:
- Set a time-deadline after which you go ask for help
Sometimes you have to deliver x or y by the end of the day and you can't afford too many hours on it. So, when you start debugging, look at the clock and set a deadline after which you'll go ask.
- Set a frustration-limit after which you go ask for help
I once got so frustrated and flustered that I deleted my entire code, doing the digital equivalent of a tableflip ragequit. It was a good lesson that sometimes one can be too frustrated to continue working on something. It will probably take time to know when you reach that point, but if you notice you're there, step away from the computer, hands in the air, and go get a fresh pair of eyes to look at it.
- Make notes of what you've learnt.
Maybe you needed to dig through the entire structure of your linux distro, maybe it was your IDE, maybe you had to read up on OOP because you hadn't understood something. Once it works, open up a note-taking system and jot down quickly things like the language, the error, what was wrong, how you fixed it (and maybe a link to the Stack Exchange solution, or post that helped you). This keeps a trace of your learning and if weeks down the line it happens again, a quick search in that file can help.
The last tip especially helps me see bugs and errors as ways of learning, rather than mere obstacles.
If you have any tips or helpful methods, feel free to leave them in the comments below, as they might also help me and other beginners.