Skip to content
Developerhome
X3

Developing with Classes and Representations (Best Practices Guide)

  Less than to read

Top five best practices for Classes and Representations:

  1. Respect label scoping: in class scripts use $EVENTS, $PROPERTIES, $METHODS, $OPERATIONS exactly as generated.
  2. Respect label scoping: in representation scripts use $EVENTS, $PROPERTIES, $METHODS exactly as generated.
  3. Use only the necessary variables declared for each label (do not reference variables not declared for that label).
  4. Add the EVENT_NOT_EXECUTED variable to the $EVENTS function in existing scripts.
  5. Add the PROPERTY_NOT_EXECUTED variable to the $PROPERTIES function in existing scripts.

In general:

  • Follow only the information in this documentation — do not add or assume extra variables or central behaviour beyond what is described here.
  • Remember to restrict cross-label variable usage to enforce clarity, and avoid fragile, implicit dependencies between labels.
  • Follow the scoping practices above exactly. Keep scope as close as possible to the declaration of a variable.
  • When in doubt, it is best to refactor so the logic executes where the required variables are declared, rather than relying on undeclared/implicit variables.

For details, see these guides: