New Issues and Model Summary

Let’s take a brief look at the new issues that we didn’t have to deal with in previous applications.

We'll cover the following

Issues to deal with

Compared to the validation and enumeration applications discussed in previous chapters, several new technical issues have now emerged.

  1. In the model code, we now have to take care of reference properties that require us to do the following:

    • Maintain referential integrity.
    • Choose and implement one of the two possible deletion policies discussed in previous chapters to manage the corresponding object destruction dependency in the destroy method of the property’s range class.
    • Handle conversions between internal object references and external ID references in the toString() serialization function, the toRecord() conversion function, and the constructor function.
  2. In the user interface view code, we now have to do the following:

    • Show information about associated objects in the “Retrieve” use case.
    • Allow the selection of an object from a list of all existing instances of the association’s target class. We also need to be able to add or remove an object from a list of associated objects in the “Create” and “Update” use cases.

Model summary

Here’s how to code each class of the JavaScript class model as an ES2015 class with implicit getters and setters.

  1. Code the property checks in the form of class-level static methods. Check to make sure that all property constraints specified in the JS class model are properly coded in the property checks.
  2. For each single-valued property, code the specified getter and setter. In each setter, the corresponding property check is invoked, and the property is only set or unset if the check doesn’t detect any constraint violations.
  3. Write the code of the toString() serialization function and the toRecord() storage conversion function.
  4. Take care of deletion dependencies in the destroy method.

Get hands-on with 1200+ tech skills courses.