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...

Windows 7 uses approximately ________ lines of code

A) 500,000 B) 2 billion C) 50 million D) 100,000

Computer Science & Information Technology

Identify the letter of the choice that best matches the phrase or definition.

A. Displays the name used to identify the div in the code B. Sets the position of the div in relation to adjacent elements as left, right, none, or inherit C. Controls how the div will appear in the browser if the content is larger than the div D. Sets the div position in relation to the top of the page or parent element E. Accepts one of the following values: absolute, fixed, relative, static, or inherit

Computer Science & Information Technology

In the example above, the user might not enter an integer, the conversion to an integer might fail, and an exception might be thrown. Why is this a problem and what are some possible options for fixing these types of errors?

What will be an ideal response?

Computer Science & Information Technology

Identify the letter of the choice that best matches the phrase or definition.?

A. ?Contains a collection of files that you want to retrieve into the style sheet B. Values that cannot be broken down into smaller parts? C. Returns the day component from anxs:datevalue? D. Date format used to return the week of the year (1-52)? E. ?Date format used to return the week of the month (1-5) F. Operator that returns every item from the first sequence that is not present in the second sequence? G. Element used to create a conditional expression? H. A sequence of items to be grouped? I. ?Common non-XML format used for transferring data from one application to another J. Function used to learn information about an XSLT processor?

Computer Science & Information Technology