What is the difference between pass by value and pass by reference in case of parent-child process model?

Certified Senior Developer

What is the difference between pass by value and pass by reference in case of parent-child process model?

  Discussion posts and replies are publicly visible

  • Hello Sudipdas,

    Please take a look at the documentation that @mudit shared it has more details on the actual behavior. Let me explain as a quick summary.

    If you pass by reference it means that the same object is passed between the parent and the child process. Technically what it means is that you can update the object in both process models. That could be a problem since 2 processes can update at the same time or information not fully consistent but it always depends on the scenario. This scenario is mostly not needed so dont use it unless necessary.

    If you pass by value the object is “copied/cloned” so the same values will be there but it can end up been different values in both processes but the parent can be updated by mapping back the value of the variable at the end of the child process

    Hope this helps

    Jose

  • 0
    Appian Employee
    in reply to josep

    I like jose's reponse - but I'd like to add more color, if that's ok:

    Think of byref as storing a pointer to a value, rather than a static value.  When the value is read in either place, the system uses the pointer to get the singular value that's used in 2 places.  If the value is changed in either place, the system follows the pointer to change that singular value for use in 2 places.

    This is valuable when you have a use case in which a particular value needs to be in sync across 2 processes. 
    Truthfully, the way we design lately, byref variables aren't used that much.  But, there are valid use cases.   A good rule of thumb is to not check that box unless you are certain the functionality is required.