New Issues

Let’s learn about some of the new issues we’ll face when we add non-functional associations.

We'll cover the following

Issues to deal with

Similar to when we deal with a functional association, as discussed in the previous chapter, we now have to deal with the following new technical issues:

  1. In the model code, we now have to the following multi-valued reference properties require implementation:

    • An add method and a remove method, such as addAuthor and removeAuthor. In addition to this, we need a setter method to assign a set of object references with the help of the add method, to possibly convert ID references into object references. All three methods may need to check cardinality constraints, if there are any.

    • A class-level check operation, such as checkAuthor, that needs to invoke the corresponding check...AsIdRef method of the property’s range class in order to check the property’s implicit referential integrity constraint.

    • Convert a collection of object references to a collection of ID references in the object-to-storage conversion function toRecord.

  2. In the user interface (view) code, we need to do the following:

    • Show information about a set of associated objects in the property column of the table view of the Retrieve/List All use case. The simplest approach is to show a comma-separated list of ID references, possibly combined with their corresponding names. Alternatively, HTML lists can be rendered in the property table’s data cells.

    • Allow the selection of a set of associated objects from a list of all existing instances of the property’s range class in the Create and Update use cases.

The last issue, regarding the selection of a set of associated objects from a list of all instances of some class, is generally not able to be solved with the help of HTML multiple select form control due to its poor usability. Whenever a set of selectable options is greater than a certain threshold (defined by the number of options that can be seen on the screen without scrolling), the multiple select element is no longer usable, and an alternative multiple-choice widget must be used.

Get hands-on with 1200+ tech skills courses.