November 14, 2019

Invariants

 

This is the point when most students begin to look ashen-faced. You are not alone and I will now introduce my own insurance policy by stating that I doubt very much whether I have found all the invariants in the Quad initial model.

Invariants are statements describing constraints that must be placed on the system. They must be added to the model because it is not always possible to glean all the necessary information from the class diagram.

Try to look at the NSR and the class diagram and then write, in plain English, what has been implied or stated in the former, but has not been made apparent in the latter. That's easier said than done, but here are a few that I have found. You may well find some that I have 'deliberately' omitted.

  1. No two artists have the same name
  2. No two buyers have the same name
  3. An artist can only take part in one solo exhibition per two-year period.
  4. The code of an artwork is unique
  5. The code of a queue is unique
  6. The gallery mount only one exhibition at a time.

The next step is to adopt a formal language, which describes each invariant in terms of classes, instances of the classes, links and associations. References to links and associations are not needed when discussing invariants based on attributes e.g. Invariant 1, but they are needed in Invariant 3.

Invariant 1
If a1 and a2 are instances of Artist then the name of a1 is not the same as the name of a2.
Invariant 2
If b1 and b2 are instances of Buyer then the name of b1 is not the same as the name of b2.
Invariant 3
If se1 and se2 are instances of SoloExhibition linked to the same instance a of Artist via presents, isPresented and creates, then the dates of se1 and se2 must be greater than two years.
Invariant 4
If a1 and a2 are instances of Artwork then the code of a1 is not the same as the code of a2.
Invariant 5
If bq1 and bq2 are instances of BuyerQueue then the code of bq1 is not the same as the code of bq2.
Invariant 6
If e1 and e2 are instances of Exhibition, such that the startDate of e1 is less than the startDate of e2, then the endDate of e1 must also be less than the startDate of e2.

 

Next page » Dynamic modelling

Previous page « What not to do

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Up to top of page