Should interfaces be re-factored to use the new a!localVariables() function?

Certified Associate Developer

We have tons of "old" SAIL interfaces that use load() and with().  Has anyone re-factored an existing interface using the new local var definition paradigm and if so, was it worth the time?  Did you see any performance improvements?   Currently, the only benefit I can see to going back through existing interfaces & re-writing them would be improved readability/simplicity. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I've done this update in a few of mine, since I had to update them anyway - it's actually fairly easy to transition.  You start by replacing the top-level "load()" with "a!localVariables", and for the most part the current load() variables don't need to be changed, with the exception of any that need their original value to stick even if variables they reference change (in which case you'd need to set "refresh on referenced variable change" to false() since it defaults to true()).

    Then, individual with() variables can be moved up into the top level variable group - again, many of these won't need to be changed further since they probably only need to update when referenced variables are changed (again, true by default).  For any that need to "always" refresh or refresh upon update of an apparently unconnected variable, these can be declared by setting the appropriate switches in a!refreshVariables.  But it shouldn't be all that many in most cases.

Reply
  • 0
    Certified Lead Developer

    I've done this update in a few of mine, since I had to update them anyway - it's actually fairly easy to transition.  You start by replacing the top-level "load()" with "a!localVariables", and for the most part the current load() variables don't need to be changed, with the exception of any that need their original value to stick even if variables they reference change (in which case you'd need to set "refresh on referenced variable change" to false() since it defaults to true()).

    Then, individual with() variables can be moved up into the top level variable group - again, many of these won't need to be changed further since they probably only need to update when referenced variables are changed (again, true by default).  For any that need to "always" refresh or refresh upon update of an apparently unconnected variable, these can be declared by setting the appropriate switches in a!refreshVariables.  But it shouldn't be all that many in most cases.

Children