01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

168<br />

Saturday Afternoon<br />

Knowing the purpose of Sequence and Collaboration diagrams<br />

There are actually three <strong>UML</strong> diagrams in the dynamic view: the Sequence diagram, the<br />

Collaboration diagram, and the Statechart diagram. Sessions 16 through 19 cover the<br />

Sequence and Collaboration diagrams, their notation and usage, and their similarities and<br />

differences. Sessions 20 through 23 deal with the Statechart diagram.<br />

The Sequence and Collaboration diagrams both illustrate the interactions between objects.<br />

Interactions show us how objects talk to each other. Each time that one object talks to<br />

another it talks to an interface (that is, it invokes an operation). So if you can model the<br />

interactions, you can find the interfaces/operations that the object requires.<br />

You may think it’s odd that the <strong>UML</strong> has two diagrams that do the same<br />

thing. In a way, you’re right. The reason is that they came from two different<br />

Tip methodologies and they each offer a slightly different perspective that can<br />

be quite valuable. (You can find more on this in Session 18.)<br />

In the Use Case view, you modeled the features of the system and developed scenarios<br />

describing how the system should behave when those features are used. The Sequence<br />

diagram provides a path from the textual descriptions of behaviors in the scenarios to<br />

operations/interfaces in the Class diagram.<br />

Mapping interactions to objects<br />

Everything in an object-oriented system is accomplished by objects. Objects take on the<br />

responsibility for things like managing data, moving data around in the system, responding<br />

to inquiries, and protecting the system. Objects work together by communicating or interacting<br />

with one another. Figure 16-1 shows a Sequence diagram with three participating<br />

objects: Bill the Customer, Bill’s Order, and the Inventory. Without even knowing the notation<br />

formally, you can probably get a pretty good idea of what is going on.<br />

Steps 1 and 2: Bill creates an order.<br />

Step 3: Bill tries to add items to the order.<br />

Step 4 and 5: Each item is checked for availability in inventory.<br />

Step 6 and 7: If the product is available, it is added to the order.<br />

Step 8: He finds out that everything worked.<br />

Building the Sequence diagram is easier if you have completed at least a first draft<br />

of the Use Case model and the Class diagram. From these two resources, you get sets of<br />

interactions (scenarios) and a pool of candidate objects to take responsibility for the<br />

interactions.

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

Saved successfully!

Ooh no, something went wrong!