Model Summary
Let's get a quick summary of the new model.
We'll cover the following
For the sake of simplicity, we won’t include the code for all constraint validation checks shown in the JS class model in our application’s code.
Summary
Code each class of the JS class model as an ES2015 class with implicit getters and setters:
- Code the property checks in the form of class-level (static) methods. Take care that all constraints of a property, as specified in the JS class model, are properly coded in the property checks.
- For each single-valued property, code the specified getter and setter so that 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 violation.
- For each multi-valued property, code its
add
andremove
operations, as well as the specifiedget
andset
operations:- Code the
add
andremove
operations as instance-level methods that invoke the corresponding property checks. - Code the setter so that it invokes the
add
operation for each item of the collection to be assigned.
- Code the
- Write the code of the serialization function
toString()
and the object-to-storage conversion functiontoRecord()
. - Take care of deletion dependencies in the
destroy
method.
Get hands-on with 1400+ tech skills courses.