0% found this document useful (0 votes)
25 views26 pages

Sequence-Collbortion Diagram

Uploaded by

mamdouhbevnoty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views26 pages

Sequence-Collbortion Diagram

Uploaded by

mamdouhbevnoty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 26

System Analysis & Design

Interaction Diagrams:
Sequence Diagram
Collbortion Diagram

Source
Mastering UML with Rational Rose
2002
Interaction Diagrams

• Shows, step-by-step, flows through a use case:


- What objects are needed for the flow
- What messages the objects send to each other
- What actor initiates the flow
- What order the messages are sent

• Sequence and Collaboration diagrams:


- Show the same information but is organized
differently
- Show it in a way that is more useful to developers
- Help to define how the system will do
- Focus on objects (classes) that will be created to
implement the functionality spelled out in the use cases

Source
Mastering UML with Rational Rose
2002
Interaction Diagrams

•In order for one class to send a message to another on a


Sequence or Collaboration diagram, there must be a
relationship between the two classes

•The steps involved in creating them:


- Find the Objects
(Examine the nouns in the flow of
events)
(Take care of attributes)
- Finding the Actors
(External stimulus (who or what) that
starts flow of events)
- Add Messages
(Communication)
Source
Mastering UML with Rational Rose
2002
Sequence Diagrams

• Sequence diagrams are interaction diagrams ordered by


time

• Each diagram represent one of the flows through a use case

•Sequence Diagram users:


•Users can look at these diagrams to see the specifics of
their business processing

•Analysts see the flow of processing in the Sequence


diagrams

•Developers see objects that need to be developed and


operations for those objects
Source
•Quality assurance
Masteringengineers
UML with Rational can
Rose see the details of the
2002
Sequence Diagrams

• Actors and Objects shown at the top of the diagram

• Each object has a lifeline, drawn as a vertical dashed line


below the object
- The lifeline begins when the object is instantiated and
ends when the object is destroyed

• A Message is drawn between the lifelines of two objects to


show that the objects communicate (each message will
become an operation). Messages can also be reflexive, showing
that an object is calling one of its own operations

Source
Mastering UML with Rational Rose
2002
Association: Unidirectional

Public class Customer Public class Flight


{ {
public Customer
public Customer() theCustomer;
{
} public Flight()
} {
}
}
Source
Mastering UML with Rational Rose
2002
Association: Bidirectional

Public class Customer Public class Flight


{ {
public Flight public Customer
theFlight; theCustomer;

public Customer() public Flight()


{ {
} }
} } Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Objects
Responsibilities

• Entity objects should hold information and


conduct business functionality

• Boundary classes
• (forms and windows) should display and
receive information, but should also do
minimal business processing
• (interfaces) should send information to another
system or receive information from another
system, but again do minimal business
processing

• Control classes should Source take care of the


Mastering UML with Rational Rose
sequencing 2002
Sequence Diagrams: Objects
Persistence
• Persistent: A persistent object is one that will be saved to a
database or to some other form of persistent storage. The
implication here is that the object will continue to exist,
even after the program has terminated

• Static: A static object is one that stays in memory until the


program is terminated. It lives beyond the execution of this
Sequence diagram, but is not saved to persistent storage.
There is, at most, one instance of a static object in memory
at any given time

• Transient: A transient object is one that stays in memory


only for a short time (until the logic in the Sequence
diagram has finished, for example)
Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Simple: This is the default value for messages.


This option specifies that the message runs in a
single thread of control

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Synchronous: When the client sends the message


and waits until the supplier has acted upon the
message

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Asynchronous: The client sends the message to


the supplier. The client then continues
processing, without waiting to see if the message
was received or not

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Balking: The client sends the message to the


supplier. If the supplier is not immediately ready
to accept the message, the client abandons the
message

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Timeout: The client sends the message to the


supplier and waits a specified amount of time. If
the supplier isn't ready to receive the message in
that time, the client abandons the message

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Procedure Call: The client sends the message to


the supplier. The client then must wait until the
entire nested sequence of messages is processed
before continuing

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Synchronization

• Return: This option indicates the return from a


procedure call

Source
Mastering UML with Rational Rose
2002
Sequence Diagrams: Messages
Frequency

• It lets you mark a message to be sent at regular


intervals

• Periodic: The message is sent on a regular,


periodic basis

• Aperiodic: The message is not sent on a


regular basis. It may be sent only once or at
irregular points in time

Source
Mastering UML with Rational Rose
2002
Combined Fragments
1. Alternatives:

Source
Mastering UML with Rational Rose
2002
Combined Fragments (cont.)
2. Loops

Source
Mastering UML with Rational Rose
2002
Collaboration Diagrams

• Show easily which objects communicate with


which other objects

• If you need to change an object, you can easily


see which other objects might be affected.
difficult to see the sequencing information

• Sequence diagrams can show a focus of control;


Collaboration diagrams can show a data flow

Source
Mastering UML with Rational Rose
2002
Example: ATM Withdrawal
1. Customer inserting his card into the card reader
2. Then, the card reader reads the card number,
3. opens Joe's account object,
4. and initializes the ATM screen.
5. The screen prompts Joe for his PIN. He enters 1234.
6. The screen verifies the PIN with the account object.
7. The screen presents Joe with his options, and he chooses
withdraw.
8. The screen then prompts Joe for the amount to
withdraw.
9. He chooses $20.
10.Then, the screen withdraws the funds from the account.
11.The account object, verifies that the account contains at
least $20.
12.Then, it deducts the funds from the account.
13.Next, it instructs the cash dispenser to provide $20 in
cash.
14.Joe's account also instructsSource the dispenser to
Mastering UML with Rational Rose
15.provide a receipt. 2002
Practice
• Create the Sequence diagram and Collaboration diagram
to the use case that adds an item to the shopping cart

• The following scenario will proceeds:


– The Customer actor issues Add white crew socks to
cart.
– Cart Interface then sends Add white crew socks to
cart to Cart Mgr
– Cart Mgr then issues Get white crew socks to Product
Mgr
– Product Mgr searches the Product Items by sending
Find product (white crew socks)
– Product Items sends Get product to White Crew Socks
– Cart Mgr then issues the Add white crew socks to cart
to the Cart Items
Source
– The Cart Items
Mastering then
UML withAdd white
Rational Rose crew socks to cart to
2002
Practice
. cont

• Create the Sequence diagram and Collaboration diagram


to the use case that adds an item to the shopping cart

• Your objects besides the actor are

1. Customer
2. Cart Interface
3. Cart Mgr
4. Product Mgr
5. Product Items
6. White Crew Socks
7. Cart Items

Source
Mastering UML with Rational Rose
2002
Source
Mastering UML with Rational Rose
2002
Source
Mastering UML with Rational Rose
2002
Thanks For
Listening
Source
Mastering UML with Rational Rose
2002

You might also like