Java Reference
In-Depth Information
Figure 16.3
UML Collaboration Diagram illustrating the Factory Pattern.
a reference to the ServerFactory object, invokes the ServerFactory.
getInstance() method. (Just how that first reference to ServerFactory
was obtained will be explained later.) In this diagram the client is shown as an
oval collaborator instead of an object because we are concentrating on the server
side objects in this collaboration diagram. The format of the message labels is
sequence - number: return - value := message (arguments)
where almost everything except the message name may be omitted.
The first step is sequence number 1, with the client passing an ID argument
to ServerFactory in the getInstance() method. The meaning and type
of the ID argument is not rigorously indicated here. It is merely some means by
which the factory can identify and distinguish the client making the request from
other clients. The ID might be a username, for instance, or a username/password
pair, or anything else that the factory requires in order to identify the clients
that connect to it. The solid arrowheads indicate synchronous operations. Since
sequence number 1 is synchronous, it must be completed before sequence num-
ber 2 can occur. But within sequence number 1 is the nested sequence 1.1, which
must be completed before sequence 1 is finished. Sequence numbers may be
nested to any depth.
There are two objects shown in the diagram - an instance of the
ServerFactory class on the right and an instance of the Server class at
the bottom of the diagram. Objects in UML are indicated with an object name
(which may be omitted), a colon, and the class name. So the instance name of the
Search WWH ::




Custom Search