29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Caller Phone Line Callee<br />

time<br />

caller lifts receiver<br />

dial tone begins<br />

dial(9)<br />

dial tone ends<br />

dial (9)<br />

dial (9)<br />

ringing tone<br />

tone stops<br />

phone rings<br />

<strong>an</strong>swer phone<br />

ringing stops<br />

Figure 18.1: A sequence diagram<br />

A variation of the basic sequence diagram (called a focus -of-control diagram) illustrates which<br />

object has the thread of control at <strong>an</strong>y one time. This is shown by a fatter line during the period when<br />

the object has control (as illustrated in Figure 18.2). Note how the bar representing the object C only<br />

starts when it is created <strong><strong>an</strong>d</strong> terminates when it is destroyed.<br />

A<br />

B<br />

C<br />

f()<br />

create<br />

g()<br />

time<br />

h()<br />

destroy<br />

Figure 18.2: Sequence diagram with focus-of-control regions<br />

18.2.2 Collaboration diagrams<br />

As stated above, collaboration diagrams illustrate the sequence of messages between objects based<br />

around the object structure (rather th<strong>an</strong> the temporal aspects of sequence diagrams). A collaboration<br />

diagram is formed from the objects involved in the collaboration, the links (perm<strong>an</strong>ent or temporary)<br />

between the objects <strong><strong>an</strong>d</strong> the messages (numbered in sequence) that are exch<strong>an</strong>ged between the objects.<br />

An example collaboration diagram is presented in Figure 18.3.<br />

148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!