Jump to: navigation, search

Debugging UBIK


Revision as of 19:57, 3 July 2023 by NWE (Talk | contribs) (A general policy for debugging)

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:

  1. Find out how to reproduce the issue reliably
    1. Ask the reporter how they reproduce it
    2. Test it ourselves and improve the reproduction if possible
  2. Find the cause for the current behavior
    1. If we get an error message, we can try to search the internet for it. Maybe somebody else has had the same problem.
    2. If this didn't help, we need to look ourselves.
    3. Try to visualize what steps the algorithm goes through in the code
    4. Create a working hypothesis: "I think what's going on is... !"
    5. Find a good entry point for debugging in the code
    6. Attach the debugger of an IDE (like Visual Studio) to the process if possible
    7. If this is not possible, try to generate log output or add debug output to the UI
    8. Inspect the steps that are gone through by the algorithm (either creating log entries, or by stepping through with the debugger)
    9. Inspect the state of involved variables throughout the algorithm (either creating log entries or by looking at the variables with the debugger)
    10. Now we adapt our hypothesis, optimize the debugging and repeat the process until we learn what is happening.
  3. Find out the desired behavior, instead of what is happening currently
    1. 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.
    2. Define the functional design (i.e., a suggestion for the desired behavior) as clearly and simply as possible.
  4. Create a technical design for the solution
    1. If we now the designated behavior, we can describe how to achieve it technically.
    2. That mostly means:
      1. Basic idea
      2. What modules are involved?
      3. Changes to the data model
      4. Changes to the algorithm (i.e., workflow logic)
    3. Define the technical design as clearly and simply as possible.
  5. Implement a fix
  6. 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®.


[edit]

Visualizing the algorithm

In order to find out what's going on and to debug efficiently, we must be able to imagine the workflow and architecture of the use-case.

In UBIK®, the behavior of any project's use-case can be distributed across multiple products, i.e., the client application with its UI customizing, and the server products including the database, the Enterprise Service, the UBIK® Web Services, and UBIK® Studio, any Plugins and Server customizing consisting of the data model, configuration objects and custom code.

The UBIK platform architecture

A good next step is to try and find out how the affected use-case is implemented. Some use-cases are very simple, but in many cases, there are quite a few modules and steps involved. We want to answer the questions: Which products and modules were used, and how do they interact?

Nearly all use-cases in UBIK® projects are either related to the mobile client or to interfacing with 3rd party systems. Though the specific implementation can be very different from others, the general flow of information throughout UBIK® modules will almost always be similar. If there is a problem, it has to occur in one of the respective steps, caused by one of the listed dependencies.

Mobile client

  1. The mobile client requests data from the Content web service, using
    • Hardware (network, client hardware)
    • Profile settings
    • Credentials
  2. The web service establishes a connection to the UBIK Environment, using
    • The network
    • The web service configuration
    • The database
    • Injected UBIK® Plugins
    • The programmatic customizing
  3. The web service tries to perform the requested action based on
    • Hardware (network, server hardware)
    • The data model
    • The programmatic customizing
    • The View configuration
    • Content data
  4. The client receives the result and tries to display it depending on
    • Hardware (network, server & client hardware)
    • The XAML customizing
    • The ACM meta definitions
    • Content data

Interfacing

Similarly, interfaces to other systems like SAP or Comos usually perform the following workflow:

  1. Somebody (or something) configures a UBIK® Enterprise Service task using its web service interface or a configuration file.
  2. An ES run is triggered, most likely using the Windows Task Scheduler.
  3. The ES establishes a connection to the UBIK Environment, using
    • The network
    • The web service configuration
    • The database
    • Injected UBIK® Plugins
    • The programmatic customizing
  4. The ES tries to perform the requested action, usually based on
    • Hardware (network, server hardware)
    • The data model
    • The programmatic customizing
    • The Proxy configuration
    • Content data
    • The external system

In this case, the UBIK® Proxy mechanism is an additional source of complexity; but there's a separate article for that.

See also