There are two general approaches for mapping an association to a set of collections. In Section 10.6.2, we map the N-ary association Statistics to two classes, a simple Statistics class to store the attributes of the association, and a StatisticsVault class to store the state of the links among the association links. In Section 10.4.2, we described an alternative approach where the association links are stored in one or both classes at the ends of the association. In the event associations were stored in both classes, we added mutually recursive methods to ensure that both data structures remained consistent. Use this second approach to map the N-ary Statistics association to Collections. Discuss the trade-offs you encounter and the relative advantages of each approach.

What will be an ideal response?

Mapping the N-ary Statistics association to a set of binary associations which are in turn mapped to a set of
collections results in a loss of information and a lot of redundancy. In Figure 10-25, there are only three methods for
retrieving statistics objects based on three possible pairs of objects. When mapping binary associations to collections,
there will be at least two different methods for each case provided by two different classes. This distribution of code
makes it more difficult to maintain it and to extend it when new classes are added to the N-ary association.
The only advantage of the binary association approach is that it is mechanical and could be supported by a code
generation tool. While this would take care of ensure that redundant code is realized correctly, it does not address the
problem of extensibility.

Computer Science & Information Technology

You might also like to view...

Which of the following allows an administrator to view malicious activity after it has taken place?

A. IDS B. IPS C. Port scanner D. Packet sniffer

Computer Science & Information Technology

Cookies are suited for session management:

a. When the session or user ID is encrypted b. If the session is encrypted with SSL/TLS c. Only as a last resort d. Only on a protected LAN or VPN

Computer Science & Information Technology