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.
-
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, thetoRecord()
conversion function, and theconstructor
function.
-
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.
- 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.
- 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.
- Write the code of the
toString()
serialization function and thetoRecord()
storage conversion function. - Take care of deletion dependencies in the
destroy
method.
Get hands-on with 1400+ tech skills courses.