As with any computing problem, the issue of performance arises. Here are a few tips that help increase the performance of forms regardless of the version of product being used.
The overarching theme is to know about and use the features of XForms when they are appropriate rather than using XFDL host language features to do the same things. The purpose of XFDL features is to add value to XForms as a host language, but sometimes those features are being used to do the same things as features in XForms. This is less efficient because XForms operates with XPath on the underlying raw data whereas XFDL operates on the formatted presentation layer. Specifically,
- If there is a data value that must be calculated, use an XForms bind with a calculate attribute rather than using an XFDL compute on a value option.
- If a piece of data is required, use an XForms bind with a required attribute rather than an XFDL format option with a mandatory setting
- If a piece of data must satisfy a constraint, such as being greater than another value or within a range, then use an XForms bind with a constraint attribute rather than using an XFDL format option with a constraint setting
- If a piece of data is known to be of a numeric type like integer, use an XForms bind with a type attribute rather than an XFDL format with a datatype. The XFDL format datatype is best for indicating currency and perhaps a date picker (for now).
- If you find that you don't want to show some controls to a user because they are not applicable, such as not collecting data associated with a senior citizen if the person gives an age less than 65, then use an XForms bind with a relevant attribute or use an XForms switch with a state attribute rather than an XFDL compute on a visible option.
Basically, operating on the XFDL presentation layer is slower for two reasons. First, the presentation layer data has to pass through internationalization/localization filters. Second, the presentation layer often has more than one user interface control bound to the same data, so the logic would have to be repeated if expressed at the wrong layer. Overall, I'd have to say that the biggest performance enhancement from the above has been observed by people who used an XForms bind with a constraint rather than an XFDL format constraint. Generally, XFDL formats are expensive, and the XForms repeat has made it easier to create lots of them, so use XFDL formats sparingly within XForms repeats (i.e. within XFDL tables).[Read More]