19
Sequence diagram example T120B029 P7 2012 pavasaris

Sequence diagram example T120B029P7 2012 pavasaris

Embed Size (px)

Citation preview

Sequence diagram example

Sequence diagram example

T120B029P7

2012 pavasaris

What is the purpose of sequence diagram ?

• The sequence diagram is used primarily to show the interactions between objects in the sequential order that those interactions occur.

• Developers think sequence diagrams were meant exclusively for them :-)

• Business staff can find sequence diagrams useful to communicate how the business currently works by showing how various business objects interact.

• A business-level sequence diagram can be used as a requirements document.

• During the requirements phase use cases are often refined into one or more sequence diagrams.

Sequence vs. Activity?• Little bit later…

Notation 1/

• An empty frame• Lifeline

Notation 2• Sending a message/methos to another object• The name is placed above the arrowed line• And represents an operation/method that the

receiving object's class implements.

Notation 3• Return messages – optional• The use of return messages depends on the

level of detail/abstraction• Return value is placed above dotted line

Notation 4• Sending a message to itself• the model draws attention to the fact that this

processing takes place in the system object.

Notation 5• Asynchronous message

Notation 6

• Who will guard the guardians themselves?• Who will guard the guardians themselves

Combined fragments (alternatives, options, and loops)

• A combined fragment is used to group sets of messages together to show conditional flow in a sequence diagram.

• Alternatives - classic "if then else" logic• Options - a simple "if then" without “else”• Loops – a repetitive sequence

Alternatives

• mutually exclusive choice between messages

Option• used to model a

sequence that, given a certain condition, will occur; otherwise, the sequence does not occur.

Loops• does not require guard condition be placed on it• a guard can have two special conditions• Minint = 1, Maxint = 5

Breaks• most commonly used to model exception handling• cause the exiting of an enclosing interaction's

sequence. • In cases where a break is part of combined fragment,

then only that fragment is exited.

Nested diagrams• Referencing another sequence diagram

Sequence(SD) vs. activity (AD)?

• AD mainly represent process flows.• SD mainly represent step by step ordered in

time interaction between different objects.• AD also repersents an object role in workflow

but level of repersenation is not dynamic like SD.

• Example: Object lifeline and detailed sequence of interaction

Online bookshop example

Facebook user authentication

in a Web application

Submit comments (AJAX)