Debugging UBIK
One of the most complex challenges when working on any software project is to debug unintended behavior. In UBIK®, there is an inherent structure to every project, which we can exploit for debugging. Let's find out, how.
A general policy for debugging
Our immediate goal in debugging is not to fix the issue. Instead, we want to find out why it behaves the way it does. Additionally, we must learn what the designated behavior is. This might be more complex than anticipated originally. Only then, we can change the underlying code or configuration to achieve the desired behavior. We can manifest this insight as a general policy for debugging:
- Find out how to reproduce the issue reliably
- Ask the reporter how they reproduce it
- Test it ourselves and improve the reproduction if possible
- Find the cause for the current behavior
- If we get an error message, we can try to search the internet for it. Maybe somebody else has had the same problem.
- If this didn't help, we need to look ourselves.
- Try to visualize what steps the algorithm goes through in the code
- Create a working hypothesis: "I think what's going on is... !"
- Find a good entry point for debugging in the code
- Attach the debugger of an IDE (like Visual Studio) to the process if possible
- If this is not possible, try to generate log output or add debug output to the UI
- Inspect the steps that are gone through by the algorithm (either creating log entries, or by stepping through with the debugger)
- Inspect the state of involved variables throughout the algorithm (either creating log entries or by looking at the variables with the debugger)
- Now we adapt our hypothesis, optimize the debugging and repeat the process until we learn what is happening.
- Find out the desired behavior, instead of what is happening currently
- In some cases, this is complex. We mustn't be afraid to think this through thoroughly, and ask responsible persons if we are not in the position to decide it.
- Define the functional design (i.e., a suggestion for the desired behavior) as clearly and simply as possible.
- Create a technical design for the solution
- If we know the designated behavior, we can describe how to achieve it technically.
- That mostly means:
- Basic idea
- What modules are involved?
- Changes to the data model
- Changes to the algorithm (i.e., workflow logic)
- Define the technical design as clearly and simply as possible.
- Implement a fix
- Retest the fix using our reproduction
This is basically independent of the product or framework you're using. With UBIK®, we can get more concrete.
Debugging UBIK®
The first step, namely to find a reproduction, stays the same as in the general case described above: Ask, test and refine. The general approach to finding the cause, namely by improving your hypothesis and inspecting what's going on, is still valid, too.
However, there are some considerations we can specify with respect to UBIK®.