Expressions and functions side effects

Hello all,

I would like to ask for a clarification on the concept of side effects of executing expressions and functions.

The section Functions and Side Effects on the Expressions page of the Documentation, states various scenarios where functions and generally expression components can be executed more than once.

For that reason, all functions should not modify external systems.

However, what is not 100% clear, is whether or not a Rule Expression that is a component of an expression that is being executed falls under the same side effects category as Functions.

Any ideas?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I think the main context of the conversation there is about the creation of new functions using plugins to extend Appian.  You definitely want your brand new Appian functions coded in JAVA to avoid any side-effects.  However, it still applies to your expressions as well.

    In the case of rules that call queries as inputs, Appian is smart enough to cache query results and prevent some side-effects, but better to design well given a system smart enough to cope with bad design than to design poorly expecting your system to be smart enough to cope with your bad design.  It's better to actively avoid side-effects in all the places you can.

Reply
  • 0
    Certified Lead Developer

    I think the main context of the conversation there is about the creation of new functions using plugins to extend Appian.  You definitely want your brand new Appian functions coded in JAVA to avoid any side-effects.  However, it still applies to your expressions as well.

    In the case of rules that call queries as inputs, Appian is smart enough to cache query results and prevent some side-effects, but better to design well given a system smart enough to cope with bad design than to design poorly expecting your system to be smart enough to cope with your bad design.  It's better to actively avoid side-effects in all the places you can.

Children
No Data