Why debugging is hard…sometimes?

 by Marko Majkic in Uncategorized

The software we are building is a complex system. A human body is a complex system too. Sometimes, when you get sick, it is very simple for MD to recognize the symptoms and to make a diagnosis. Based on that, she will prescript your therapy and the most of the times, you’ll be well after a week or two. If this therapy doesn’t work, doctor will request more analysis and exams, so she could gather enough (new) information to make a new diagnosis. As you can see, all these diagnoses are assumptions and you’ll get the treatment based on these doctor’s assumptions. These assumptions are based on doctor’s knowledge and experience. Eventually you’ll get better. Why’s that? Why can’t doctor just make the right diagnosis the first time? Because our bodies are complex systems. Because there are uncertainties in medical science. Because there are still unknowns in medical science. That’s why becoming doctor is hard. There are millions of information which doctor needs to know. And more than that – they need to be smart and use these information to come to the solution.

The same case is for software engineering. The most of the time, fixing a bug will be easy since we know our system and we know how to analyze and debug the problem. Especially if we already experienced similar bug previously. Sometimes, tracing the problem is not that easy. There are certain factors which will make it harder for you:
– Bug is not easy to reproduce (if possible at all);
– Bug is happening periodically, without obvious pattern;
– The bug is tightly connected with the third-party software or library;

What can we do?
– Get more information during the runtime, so we have them when a bug occurs. Similar to additional analysis and exams ordered by doctor;
– Make the consequence visible to end user. Notify him that his action produced the error and his action has not been executed;
– Try to isolate the problem and determine where it comes from.
– Remove third-party dependency or try another one, which doesn’t produce the problem.

Marko MajkicWhy debugging is hard…sometimes?