219
On the face of it, the situation in Figure 6.23 is straightforward. A book may have
been the subject of a loan (or it might not, since it could be newly acquired), and a
borrower might, or might not, have taken out a book on loan. If a loan exists,
though, it must ipso facto be a loan of a book to a borrower. This much could
probably be deduced from just thinking about the three entities, but, some years
ago, one of the authors attempted to join his local public library. It emerged that,
to do so, he was obliged to borrow at least one book – which, on our data model,
would mean that the relationship between Borrower and Loan would have to be
shown as fully mandatory.
However, we also have to consider the issue of time in constructing data models.
If, in our library system, we learned that the librarians want to keep Loans on file
for five years and then erase them, a fully mandatory relationship with Borrower
would mean that if someone has not borrowed a book for five years then their
entity would have to be erased also (since we have just said that we cannot have a
Borrower with no Loans attached). This might be what the librarians want: if
Borrowers have not borrowed a book for five years, they must rejoin the library.
But if it is not what they want, then we will have to restore the optional quality of
the relationship, so that we can remove a Loan without removing its associated
Borrower.
This little scenario helps to explain why data modelling is the province of a
business analyst, since what we have just explored are the business rules that
cover the capture, storage and disposal of data. Such rules cannot be deduced by
a developer sitting many kilometres away – or perhaps on the other side of the
globe, in an offshore situation – but require careful discussion and analysis with
business users.
Technique 64: Class modelling
(Before reading this section, readers are recommended to study the previous
technique, ‘entity relationship modelling’, since many of the concepts explained
there are also relevant to the understanding of class models.)
Variants/Aliases
This is also known as object class modelling.
Description of the technique
An object class model – often referred to as simply a class model – is the
UML/object-oriented version of a data model. That is, it shows the data to be
held within a system and the way the various data items are connected with each
other. The concepts involved are similar to those in entity relationship models,
but the UML notation has some additional features that enrich our understanding
of the data.
As with an entity relationship model, a class model provides a better
understanding of the data that is used within an organisation and that may
need to be stored and manipulated within a computer system, together with a
stronger grasp of the business rules that govern the creation, use and deletion
of data by the organisation.
DEFINE REQUIREMENTS