Have you ever felt completely helpless in a rainy cold night when dealing with a software bug? A feature used to function perfectly, but it no longer does. Why can’t things just operate the way they used to? Why do computers have to be so cold, complex and stupid?
Computers have utterly irritated me too across my entire career. Specially when talking about the unexpected hits of build systems like Gradle in Java and Android which suddenly throws error messages out of nowhere that could literally take hours or days to work out. Despite the fact that I am a skilled programmer now, I still have an almost overwhelming dread of not being able to solve these issues. So where do these issues came from?
Computers are very good at performing precisely what they are instructed to do. They’re so excellent at that, like a perfectly obedient three-year-old, they execute their instructions literally, regardless of your permanent belief of doing the right thing 🙂 . Computers will utterly obliterate your data or send that email before you’ve finished composing it. They display messages on your screen (On your demand) and push you to make choices “Are you sure you want to exit?”. Unfortunately, computers are only messengers. The reason for their anguish is because their programmer took shortcuts and was careless to instruct them well.
All right, so what should you do now? The current situation leads to one very important fact that you’re not going to enjoy. You’ll have to learn how a computer works. I know you hate to, and it will take a long time, but it’s the only way out. It’s the only way to figure out why the software on your computer isn’t working and behaves unexpectedly. Although I’m very fond of the “Knowledge is Power” quote of Francis Bacon. Knowledge is a skill. The only way to fix something is to understand why it does not function.
So how could you manage to catch, analyze and fix your software bugs?
Though writing code almost daily for 5 years now it’s yet to produce a totally bug free application. I take that as my power point, I learn from every project and improve my abilities to detect bugs and bad code practices that could generate future bugs. It’s the normal software engineer lifecycle. So I need to prepare & equip myself to kill any bug once it’s caught by the QA team. Here are some tips how I do that:
1- If You Cannot Reproduce it .. It’s Not a Bug!
There will come days that a person from the QA team swears by the honor of his family that he saw the bug on his own machine but it does Not on yours. On the other side you generated your assumptions and potential reasons for the description the QA person provided on the bug ticket, but the bug keeps re-opened!
That’s what happen when you start working on a bug without trying to reproduce it first. If it doesn’t appear on your machine try to catch it on other teammate’s machine or try another testing account credentials. Your time is precious, have them prove it to you and then reproduce it for yourself. There’s nothing worse than spending hours on a wild goose chase!
2- Familiarize Yourself with the Technology Stacktrace
Not every bug will have a stack trace, but most of them do. The ability to read and understand them in seconds is an incredible skill. The key to remember is that the root cause, the filthy culprit that broke your perfect day, is usually wrapped up several layers deep. So work from the bottom of the scary long stack trace upwards to find the root cause!
3- Automate it.. Till you Fix it!
I know you’re not a TDD big fan, but I can tell you that I’ve felt unstoppable at times when I wrote a JUnit, Espresso or Flutter Driver test case to assist me diagnose and close a bug. First of all, it maintains that bug. It also speeds up your time as you don’t have to start a whole app and just reach the crashing screen 6 or 7 times by clicking. It’ll help to make sure that your bug never comes back!
4- Know Your Error Codes
When I try to help in a hiring process in my working place, I insist to put the computer networking basic knowledge on top of the requirements. That’s because in a case like that where we have server error codes instead of the expected responses. So if you don’t know what these codes refer to or at least what to search about on Google you’ll lose the pace or waste someone else’s time for a CS graduate level topic. knowing what the HTTP error code means can be a huge help in diagnosing bugs!
- 404 – You might have the wrong URL in your app
- 401 – Your credentials are likely wrong
- 418 – You’re talking to a teapot! (seriously https://tools.ietf.org/html/rfc2324)
- 429 – You’re making too many requests
- If you get an HTTP error code, always Google it to make sure you understand it. Again, it’ll save you a lot of time! The same goes for Database drivers and other protocols. If you see an error code, Google it with the name of the database and look for the official docs.
5- Google it!
Whatever your search engine of choice is, you’re sure to find a helpful answer somewhere in the internet. Just gather up as much information as possible before you hit “search” in the search engine
It takes time to figure out why a piece of software is performing strangely. It’s not very difficult to work with computers, but when confronted with a problem, you can’t give up on how to solve them. That’s why I have enormous respect for Kindergarten teachers since I would lose my mind trying to deal with a bunch of children
Then take a break if your efforts and solutions doesn’t work. Think of things. Think of things. Go get a cup of coffee or take a walk. Do anything that helps you mute your mind chaos. When you return, you’ll have fresh perspectives on how to approach the unapproachable.