How to make this design model has been discussed in the previous chapter (about unidirectional associations).
The meaning of the design model and its reference property
publisher can be
illustrated by a sample data population for the two model classes
Table 12.1. Sample data for
|Bantam Books||New York, USA|
|Basic Books||New York, USA|
Table 12.2. Sample data for
|0553345842||The Mind's I||1982||Bantam Books|
|1463794762||The Critique of Pure Reason||2011|
|1928565379||The Critique of Practical Reason||2009|
|0465030793||I Am A Strange Loop||2000||Basic Books|
Create a check operation for each non-derived property in
order to have a central place for implementing property constraints. For a standard identifier
property (such as
Book::isbn), three check operations are needed:
A basic check operation, such as
checkIsbn, for checking all
syntactic constraints, but not the mandatory
value and the uniqueness
A standard ID check operation, such as
checkIsbnAsId, for checking the
mandatory value and uniqueness constraints that are required for an identifier (or primary key) attribute.
An ID reference check operation, such as
checkIsbnAsIdRef, for checking the referential
integrity constraint that is required for an ID
reference (IdRef) (or foreign key)
For a reference property, such as
Book::publisher, the check
Book.checkPublisher, has to check the corresponding referential integrity constraint, and possibly also a mandatory value constraint, if the property is mandatory.
Create a setter operation for each non-derived single-valued property. In the setter, the corresponding check operation is invoked and the property is only set, if the check does not detect any constraint violation.
Book, where the
class-level ('static') methods are shown underlined:
We have to perform a similar transformation also for the class
depicted in the following class diagram.