Number of arguments
Limit the number of arguments in your UDRs and make sure
that these arguments do not make the routine modal. A
modal routine uses a special argument as a sort of flag to determine
which of several behaviors it should take. For example, the following
statement shows a routine call to compute containment of spatial values:
Containment(polygon, polygon, integer);
This routine determines whether the first polygon contains the second polygon or whether the second contains the first. The caller supplies an integer argument (for example, 1 or 0) to identify which value to compute. This is modal behavior; the mode of the routine changes depending on the value of the third argument.
In the following example,
the routine names clearly explain what computation is performed:
Contains(polygon, polygon)
ContainedBy(polygon, polygon)
Always construct your routines to be nonmodal, as in the second example.