Suggested answer for Exercise 7.1

advertisement

Suggested answer for Exercise 7.1

The diagram below shows the complete component diagram based on the code for the booking system implementation.

Suggested answer for Exercise 7.2

A deployment diagram showing two PCs and a machine running as an application server is shown below. Notice that nodes in the diagram can be labelled as objects, as they are thought of as instances of a general class of machine.

Suggested answer for Exercise 7.3

A deployment diagram for this configuration is similar to that in the previous question. Both illustrate a general client-server relationship.

Suggested answer for Exercise 7.4

The diagram corresponding to Figure 7.5 is the following. Notice that there is no instance of the hotspot class: the object participating in the interaction is an instance of the specialized subclass.

The diagram corresponding to Figure 7.6 is the following.

The diagram corresponding to Figure 7.6 is the following. This diagram shows the `displayContent' message which is sent when the

`redisplay' message is executed.

Suggested answer for Exercise 7.5

The diagram below is formed by combining and extending Figures 7.8 and 7.8. It shows the major additional relationships introduced in the code for the booking system, namely the use of dialog classes to get information from the user. The dialog classes contain specific interface components such as buttons and text fields: as an example, an association is shown documenting the text field component in the date dialog class. Other associations could be drawn to model other dialog components.

Some relationships that are visible in the code are implicit in this diagram: for example, the `StaffUI' class contains a number of event listeners. It may appear as if this is not visible in the diagram, but in fact they are accounted for by the dependent from java.awt.Component

to the `EventListener' interface: as `StaffUI' is, indirectly, a subclass of `Component', this dependency applies to it as well, and does not need to be shown again.

Download