Object Oriented Programming using C#
Case Study
We don’t know of any simple attributes which ClientBook and MessageSet will require, but they will need to be associated
with other classes so we still have some work to do there – hence the ?s (which are not an official part of UML).
Relationships Between Classes
We can now start to work out how these classes are related.
Starting with ClientBook and Client :- a ClientBook will record details of zero or more clients.
The navigability will be from ClientBook to client because the book “knows about” its Clients (in implementation terms
it will have references to them) but the individual Clients will not have references back to the book.
The one-to-many relationship suggests that ClientBook will have a Collection (of some kind) of Clients. The specification
states that each Client will have a unique ID thus the collection will in fact be a dictionary where each entry is made up
of a pair of values – in this case a clientID (an int) and a Client object. As we are likely to be searching and retrieving
clients by their ID far more often than we will be adding and deleting clients the system will be more efficient if we make
this dictionary a sorted dictionary, where the clients will be stored in order of their ID. With a sorted dictionary adding
and deleting elements will be slower as the process is more complex but retrieving elements will be quicker.