next up previous contents
Next: 3.3 Optional Clientship Annotations Up: 3. Yet Another Object Notation Previous: 3.1 Classes

Subsections


  
3.2 Clientship Relation

A clientship relation exists between a class called client and a class called server. This relation is unidirectional and there exists an arrow from the client_class to the server_class if the client uses a method from the server. This is a static relation, i.e. it can be detected at compilation time. This relation is depicted as in Fig. 10.


  
Figure 10: Client Server Relationship
\begin{figure}
\begin{picture}
(400,110)(0,0)
%\graphpaper(0,0)(400,110)
\put...
...3mm} & \hspace*{2cm}\\
& \\ \hline
\end{tabular} }
\end{picture} \end{figure}

3.2.1 Permanent versus Transient Clientship Relation

Using this relation, one can specify the interval of time the relation exists. If the client has the data in its main structure, the relation is said to be permanent. Otherwise, if the client objects have visibility only during the method call, the relation is said to be transient. A permanent relation is denoted with a circle inside the class symbol; a transient relation with a circle outside the class symbol (see Fig. 11).


  
Figure 11: Transient versus Permanent Clientship Relation
\begin{figure}
\begin{picture}
(460,110)(0,0)
%\graphpaper[20](0,0)(460,110)
...
...3mm} & \hspace*{2cm}\\
& \\ \hline
\end{tabular} }
\end{picture} \end{figure}

3.2.2 Attached versus Detached Clientship Relation

A characteristic to be specified of a client/server relationship is whether the client holds a reference to the server or if it holds the actual state of the server (a value). In the first case the relationship is said to be detached, whereas in the second case, it is said to be attached. Attached clientship relations are denoted with a filled circle whereas detached clientship relations are denoted with a transparent circle. A detached relationship is useful in the following situation. A client requests information from the server. This information is stored as an object inside the server. If the server passes a reference to this object, the client can use this reference to change the object inside the server directly. To avoid this, the server must send the value of the object to protect it from unproper use (see [Atk91]). In Java this is done by the addition of object serialization.


  
Figure 12: Attached versus Detached Clientship Relation
\begin{figure}
\begin{picture}
(460,111)(0,0)
%\graphpaper[20](0,0)(460,110)
...
...3mm} & \hspace*{2cm}\\
& \\ \hline
\end{tabular} }
\end{picture} \end{figure}

Object serialization technology is commonly used to store some of the state of a program so that one can later easily restore the program to the current state. That is, object serialization implements object persistence.

Every clientship arrow has a small circle at the client's end (i.e. the tail). If the circle is transparent the clientship is detached whereas if the circle is a black bullet the clientship is attached. The server is in a sense a part-of, or stored within it.