VMware Aria Automation Tools

 View Only

Hint: Variablized Modules, a Blind Spot of Find Usages/Dependencies

  • 1.  Hint: Variablized Modules, a Blind Spot of Find Usages/Dependencies

    Posted May 18, 2023 04:15 AM
    Edited by Stefan Schnell May 07, 2024 12:33 AM

    These days I have been working on performance measurements of code sequences. In this context I noticed that the where-used list of the orchestrator, Find Usages and Find Dependencies, does not resolve variableized method calls of getModule.

    Here an example. At first I created an Action testStefan001, which delivers an everyday term :

     

     

    return "Hello World";

     

     

    At the second step I created an Action testStefan002, which calls this action on two different ways:

     

     

    var ret = System.getModule("de.stschnell").testStefan001();
    
    var module = System.getModule("de.stschnell");
    for (var i = 0; i < 5; i++) {
      ret += module.testStefan001();
    }
    
    ret += System.getModule("de.stschnell").testStefan001();
    
    return ret;

     

     

    The first way is the direct call and the second way is an indirect way via an object variable. The second way offers a better performantce, because the instantiation is done only once, before the loop. So far so good. Now let's take a look at the where-used list.

    StefanSchnell_0-1684381913111.png

    The calling module shows only the lines in which the call is made directly.

    StefanSchnell_1-1684382069282.png

    The called module also shows only the direct calls. The indirect method call, via a variablized module, is not considered.

    Conclusion

    As can be seen, the variabilization of the module has its advantages and disadvantages. When using the where-used list, we just have to be aware that the displayed lists do not have to be fully comprehensive. We may need to bring more code analysis techniques to use.