software engineering design & modeling sequence diagram communication diagram communication...

86
Software Engineering Software Engineering Design & Modeling Design & Modeling Sequence Diagram Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

Upload: gervase-mills

Post on 04-Jan-2016

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

Software Engineering Software Engineering Design & ModelingDesign & Modeling

Sequence DiagramSequence Diagram

Communication Communication DiagramDiagram

Timing DiagramTiming Diagram

Page 2: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

2

Introduction Introduction

We started looking at the static aspects We started looking at the static aspects of UML models in the earlier chapters of UML models in the earlier chapters – classes and objects diagrams– classes and objects diagrams

In previous chapter, we began to In previous chapter, we began to explore the dynamic aspects of UML explore the dynamic aspects of UML model – use case diagramsmodel – use case diagrams

In this chapter, we are going to see In this chapter, we are going to see how to look at the static and dynamic how to look at the static and dynamic aspects of a system in parallel.aspects of a system in parallel.

Page 3: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

3

Chapter OutlineChapter Outline InteractionsInteractions

Definition Definition Messages and actionsMessages and actions Sequencing Sequencing Modelling an interactionModelling an interaction

Interaction diagramInteraction diagram Sequence diagramSequence diagram Collaboration diagramCollaboration diagram Timing diagramTiming diagram

Robustness AnalysisRobustness Analysis Case StudyCase Study

Page 4: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

InteractionsInteractions

Page 5: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

5

Introduction Introduction

In every system, objects do not just sit In every system, objects do not just sit idle; they interact with one another by idle; they interact with one another by passing messages.passing messages.

In the UML, the dynamic aspects of a In the UML, the dynamic aspects of a system is modelled using interactionssystem is modelled using interactions An interaction sets the stage for its behaviour An interaction sets the stage for its behaviour

by introducing by introducing all the objects that work together to carry out some all the objects that work together to carry out some

action, and action, and the messages that are dispatched from object to the messages that are dispatched from object to

objectobject

Page 6: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

6

DefinitionDefinition An interaction is a behaviour that comprises An interaction is a behaviour that comprises

a set of messages exchanged among a set of a set of messages exchanged among a set of objects within a context to accomplish a objects within a context to accomplish a purposepurpose

Interactions can be found wherever objects Interactions can be found wherever objects are linked to one another, e.g.are linked to one another, e.g. in the collaboration of objects that exist in the in the collaboration of objects that exist in the

context of a system and subsystem as a wholecontext of a system and subsystem as a whole among objects in the implementation of an among objects in the implementation of an

operationoperation in the context of a class in order to visualize, in the context of a class in order to visualize,

specify, construct and document the semantic of a specify, construct and document the semantic of a classclass

Page 7: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

7

Messages & ActionsMessages & Actions A message is a communication between A message is a communication between

two objects, or within an object, that is two objects, or within an object, that is designed to result in some activity.designed to result in some activity.

This activity involves one or more actions, This activity involves one or more actions, which are executable statements that which are executable statements that result in result in changes in the values of one or more changes in the values of one or more

attributes of an object, attributes of an object, or the return of some value(s) to the object or the return of some value(s) to the object

that sent the message, that sent the message, or bothor both

Page 8: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

8

There are 5 kinds of actions that There are 5 kinds of actions that the UML explicitly supports: -the UML explicitly supports: - Call and ReturnCall and Return Create and DestroyCreate and Destroy SendSend

Page 9: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

9

Call actionCall action A call action invokes an operation on an objectA call action invokes an operation on an object It is synchronous, meaning that It is synchronous, meaning that

the sender assumes that the receiver is ready to the sender assumes that the receiver is ready to accept the message, accept the message,

and the sender waits for a response from the and the sender waits for a response from the receiver before proceedingreceiver before proceeding

The UML represents a call action as an arrow The UML represents a call action as an arrow from the calling object to the receiving objectfrom the calling object to the receiving object

: Class Object: Class

action name

action name

A call action that involves two objects

A call action from an object to itself

A lifeline

Page 10: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

10

Return actionReturn action A return action is the return of a value to the A return action is the return of a value to the

caller, in response to a call actioncaller, in response to a call action The UML represents a return action as a The UML represents a return action as a

dashed arrow from the object returning the dashed arrow from the object returning the value to the object receiving the valuevalue to the object receiving the value

: Class Object: Class

return value

Page 11: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

11

: Customer : CustomerReview

assignRating()

computeAvgRating()

average rating

Example :- Call and Return action

Page 12: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

12

Create actionCreate action A create action creates an objectA create action creates an object

It tells a class to create an instance of itselfIt tells a class to create an instance of itself In the UML, create action is represented as In the UML, create action is represented as

an arrow with the stereotype an arrow with the stereotype <<<<createcreate>>>> from from the object that invokes the create action to the object that invokes the create action to the created objectthe created object

Object: Class : Class

<<create>>

Object: Class

: Classcreate an object

UML 2.0UML 1.x

Page 13: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

13

Destroy actionDestroy action A destroy action destroys an objectA destroy action destroys an object

It tells an object to destroy itselfIt tells an object to destroy itself An object can perform a destroy action on another An object can perform a destroy action on another

object, or on itselfobject, or on itself In the UML, a destroy action is represented as an arrow In the UML, a destroy action is represented as an arrow

with the stereotype <<destroy>> (UML 1.x) from the with the stereotype <<destroy>> (UML 1.x) from the object that invokes the action to the destroyed object. A object that invokes the action to the destroyed object. A large X is also added at the end of the destroy arrow to large X is also added at the end of the destroy arrow to denote that the object’s lifeline has been terminateddenote that the object’s lifeline has been terminated

Object: Class : Class

<<destroy>>X

Page 14: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

14

Send actionSend action A send action sends a signal to an objectA send action sends a signal to an object A signal is an asynchronous communication A signal is an asynchronous communication

between objectsbetween objects One object “throws” a signal to another object that One object “throws” a signal to another object that

“catches” the signal“catches” the signal The sender of the signal does not expect a response from The sender of the signal does not expect a response from

the receiver (unlike the sender of a call action)the receiver (unlike the sender of a call action) Exceptions are the most common type of signalsExceptions are the most common type of signals

In the UML, a send action is represented as an In the UML, a send action is represented as an arrow with a half arrowhead at the lifeline of the arrow with a half arrowhead at the lifeline of the receiving objectreceiving object

: Class Object: Class

action name

: Class Object: Class

action name

UML 1.x UML 2.0

Page 15: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

15

In the UML, a signal is represented as In the UML, a signal is represented as stereotyped classes or as signals that objects stereotyped classes or as signals that objects belonging to a given class can respond to.belonging to a given class can respond to.

The attributes of a signal serve as the signal’s The attributes of a signal serve as the signal’s parameters when an object sends the signal to parameters when an object sends the signal to another objectanother object

The extra compartment in the class box contains the The extra compartment in the class box contains the names of the signals to which objects of a given class names of the signals to which objects of a given class can respond to.can respond to.

Will learn more about signals in later chapters…Will learn more about signals in later chapters…

attribute : attribute : typetype

<<<<signalsignal>>>>

SignalSignal

SignalsSignals SignalSignal

ClassClass

Page 16: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

16

Example: A send action, with its sample signal

: Login Page : Exception Handler

BadPassword(userID)

userID : userID : StringString

<<<<signalsignal>>>>

BadPasswordBadPassword

SignalsSignals BadPasswordBadPassword

ExceptionHandlExceptionHandlerer

Page 17: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

17

Asynchronous messageAsynchronous message A message is sent by one object to another but the first object A message is sent by one object to another but the first object

does not wait until the resulting action has completed, it does not wait until the resulting action has completed, it carries on with the next step in its own sequence of actions.carries on with the next step in its own sequence of actions.

Synchronous messageSynchronous message A message is sent by one object to another and the first object A message is sent by one object to another and the first object

waits until the resulting action has been completed.waits until the resulting action has been completed. Creation messageCreation message

Represents a message that causes the creation of an object Represents a message that causes the creation of an object instance to which the message is sent.instance to which the message is sent.

Reply messageReply message Represents the explicit return of control from the object to Represents the explicit return of control from the object to

which the message was sent.which the message was sent. Lost messageLost message

Have a send event but the receive event is unknown, normally Have a send event but the receive event is unknown, normally because they do not reach their destination.because they do not reach their destination.

Found messageFound message Have a receive event, but their origin is unknown, possibly, Have a receive event, but their origin is unknown, possibly,

because it is outside the scope of the description.because it is outside the scope of the description.

Page 18: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

18

SequencingSequencing When an object passes a message to When an object passes a message to

another object, the receiving object might another object, the receiving object might in turn send a message to another object, in turn send a message to another object, which might send a message to yet a which might send a message to yet a different object, and so on.different object, and so on.

This stream of messages forms a sequenceThis stream of messages forms a sequence Any sequence Any sequence

must have a beginning: the start of every must have a beginning: the start of every sequence is rooted in some process or thread sequence is rooted in some process or thread

will continue as long as the process or thread will continue as long as the process or thread that owns it livesthat owns it lives

Page 19: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

19

Each process or thread within a Each process or thread within a system defines a distinct flow of system defines a distinct flow of control, and within each flow, control, and within each flow, messages are ordered in sequence by messages are ordered in sequence by timetime The order of the message relative to the The order of the message relative to the

start of the sequence can be modelled by start of the sequence can be modelled by prefixing the message with a sequence prefixing the message with a sequence number, set apart by a colon separatornumber, set apart by a colon separator

A filled solid arrowhead is used to specify a A filled solid arrowhead is used to specify a procedural or nested flow of controlprocedural or nested flow of control

A stick arrowhead is used to specify a flat flow A stick arrowhead is used to specify a flat flow of control, to model the non-procedural of control, to model the non-procedural progression of control from step to stepprogression of control from step to step

Page 20: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

20

: View c : Controller : Cache

2 : clickAt() 2.2 : putRecentPick()

2.1 : findAt()

sequence number message

nested flow of control

c : Caller : Telephone : Exchange

1 : liftHandset() 2 : assertCall()

sequence number message

flat flow of control

link

Page 21: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

21

Modelling an Modelling an interactioninteraction

When modelling an interaction, we need to include When modelling an interaction, we need to include both objects and messagesboth objects and messages each object plays a specific roleeach object plays a specific role each message represents the communication between each message represents the communication between

objects, with some resulting actionobjects, with some resulting action We can visualize objects and messages in an We can visualize objects and messages in an

interaction in two ways: -interaction in two ways: - by emphasizing the time ordering of its message : by emphasizing the time ordering of its message :

sequence diagramsequence diagram by emphasizing the structural organization of the by emphasizing the structural organization of the

objects that send and receive messages : objects that send and receive messages : communication diagramcommunication diagram

Both sequence and communication diagram are Both sequence and communication diagram are examples of interaction diagramsexamples of interaction diagrams

Page 22: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

Interactions Interactions diagramdiagram

Page 23: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

23

Introduction Introduction In the UML, an interaction diagram is used to In the UML, an interaction diagram is used to

model the dynamic aspect of a system.model the dynamic aspect of a system. These dynamic aspect may involve : -These dynamic aspect may involve : -

the interaction of any kind of instance in any view of the interaction of any kind of instance in any view of a system’s architecture, including instances of a a system’s architecture, including instances of a class, interface, components and nodes.class, interface, components and nodes.

a system as a whole, a subsystem, an operation or a a system as a whole, a subsystem, an operation or a classclass

Interaction diagrams can also be attached toInteraction diagrams can also be attached to use cases : to model scenariosuse cases : to model scenarios collaborations : to model the dynamic aspects of a collaborations : to model the dynamic aspects of a

society of objectssociety of objects

Page 24: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

24

Definition Definition

An interaction diagram shows an An interaction diagram shows an interaction, consisting of a set of objects interaction, consisting of a set of objects and their relationships, including the and their relationships, including the messages that may be dispatched among messages that may be dispatched among them.them.

An interaction diagram contains: -An interaction diagram contains: - objectsobjects linkslinks messagesmessages may also contain notes and constraints.may also contain notes and constraints.

Page 25: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

25

An interaction diagram can be used in An interaction diagram can be used in two ways: -two ways: - To model flows of control by time orderingTo model flows of control by time ordering

emphasizes the passing of messages as they emphasizes the passing of messages as they unfold over timeunfold over time

Sequence Diagram and Timing Diagram are Sequence Diagram and Timing Diagram are used to model thisused to model this

To model flows of control by organizationTo model flows of control by organization emphasizes the structural relationships among emphasizes the structural relationships among

the instances in the interaction, along which the instances in the interaction, along which messages may be passedmessages may be passed

Communication Diagram is used to model thisCommunication Diagram is used to model this

Page 26: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

26

Sequence diagramSequence diagram

A sequence diagram is an interaction A sequence diagram is an interaction diagram that emphasizes the time ordering diagram that emphasizes the time ordering of messages (sequence of calls).of messages (sequence of calls).

A sequence diagram is formed by: -A sequence diagram is formed by: -1.1. Placing the objects that participate in the Placing the objects that participate in the

interaction at the top of the diagram, along the interaction at the top of the diagram, along the X-axisX-axis The object that initiates the interaction is placed on The object that initiates the interaction is placed on

the left most, and the other subordinate objects are the left most, and the other subordinate objects are placed to the rightplaced to the right

2.2. Placing the messages that these objects send Placing the messages that these objects send and receive along the Y-axis, in order of and receive along the Y-axis, in order of increasing time from top to bottomincreasing time from top to bottom

Page 27: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

27

A sequence diagram has four key elements: -A sequence diagram has four key elements: - Objects appear along the top marginObjects appear along the top margin Each object has a lifeline, which is a dashed line that Each object has a lifeline, which is a dashed line that

represent the life and perhaps death of the objectrepresent the life and perhaps death of the object Most objects will be in existence for the duration of the Most objects will be in existence for the duration of the

interactioninteraction Objects may also be created during the interaction, or Objects may also be created during the interaction, or

destroyeddestroyed A focus of control, which is a tall thin rectangle that A focus of control, which is a tall thin rectangle that

sits on top of an object’s lifelinesits on top of an object’s lifeline It shows the period of time during which an object is It shows the period of time during which an object is

performing an action, either directly or through subordinate performing an action, either directly or through subordinate procedureprocedure

The bottom part of a focus of control can be marked by a The bottom part of a focus of control can be marked by a return messagereturn message

Messages show the actions that objects perform on Messages show the actions that objects perform on each other and on themselveseach other and on themselves

Page 28: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

28

Notations of Sequence Notations of Sequence DiagramsDiagrams

FramesFrames Sequence diagrams are drawn in Sequence diagrams are drawn in

frames. Frames are new in UML 2.0.frames. Frames are new in UML 2.0.

sd Interanction name

heading

Content area time

lifeline

Page 29: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

29

Lifelines Lifelines Participating instances are represented Participating instances are represented

in a sequence diagram by a dashed in a sequence diagram by a dashed vertical line with, usually, a rectangle vertical line with, usually, a rectangle representing an object at the top of the representing an object at the top of the line.line. lifeline name

Page 30: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

30

MessagesMessages As previous slideAs previous slide

Page 31: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

31

Combined fragmentsCombined fragments altalt

Alternatives : a choice in which at most one Alternatives : a choice in which at most one operand’s condition will evaluate to true.operand’s condition will evaluate to true.

optopt Option : a choice in which either this Option : a choice in which either this

fragment will execute or it will not, fragment will execute or it will not, depending on whether the operand’s depending on whether the operand’s condition evaluates to true.condition evaluates to true.

looploop Loop : used to show that a fragment will be Loop : used to show that a fragment will be

executed repeatedlyexecuted repeatedly

Page 32: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

32

breakbreak parpar seqseq strictstrict negneg criticalcritical ignoreignore considerconsider assertassert

Page 33: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

33

Interaction occurrencesInteraction occurrences Another way of hiding detail in Another way of hiding detail in

sequence diagrams has been introduced sequence diagrams has been introduced in UML 2.0 with the use of interaction in UML 2.0 with the use of interaction occurrences.occurrences.

ref

Page 34: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

34

StatesStates States can be placed on a lifeline to States can be placed on a lifeline to

indicate the state that an object must indicate the state that an object must be in as a pre-condition of an action or be in as a pre-condition of an action or that it makes a transition to as the post-that it makes a transition to as the post-condition of an action.condition of an action.

idle

Messages that take times to reach their destinations

Page 35: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

35

C : Client

: Transactioncreate a transaction

p : ODBCProxy

X

setActions(a, d, o)setValues(d, 3, 4)

setValues(a, “CO”)

committed

<<destroy>>

objects

time

focus of control

lifeline

Example of a sequence diagram

Page 36: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

36

Communication diagramCommunication diagram

A communication diagram is an interaction A communication diagram is an interaction diagram that emphasizes the structural diagram that emphasizes the structural organization of the objects that participate in organization of the objects that participate in an interaction (send and receive messages) an interaction (send and receive messages) (emphasize on links).(emphasize on links).

A communication diagram is formed by:-A communication diagram is formed by:-1.1. Placing the objects that participate in the Placing the objects that participate in the

interaction as the vertices in a graphinteraction as the vertices in a graph2.2. Rendering the links that connect these objects as Rendering the links that connect these objects as

the arcs of this graphthe arcs of this graph3.3. Adorning these links with the massages that the Adorning these links with the massages that the

objects send and receiveobjects send and receive

Page 37: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

37

A communication has four key elements: -A communication has four key elements: - Objects appear at the vertices of the graphObjects appear at the vertices of the graph Paths that indicate how one object is linked to Paths that indicate how one object is linked to

anotheranother A path stereotype can be attached to the far end of a link, A path stereotype can be attached to the far end of a link,

e.g. e.g. <<<<locallocal>>>>, , <<<<parameterparameter>>, <<>>, <<globalglobal>>>>, and , and <<<<selfself>>>> Sequence number to indicate the time order of a Sequence number to indicate the time order of a

messagemessage Each message is prefixed with a unique sequence numberEach message is prefixed with a unique sequence number The UML standard is decimal numbering ( 1 is the first The UML standard is decimal numbering ( 1 is the first

message; 1.1 is the first message nested in the first message; 1.1 is the first message nested in the first message; and so on)message; and so on)

Messages show the actions that objects perform on Messages show the actions that objects perform on each other and on themselveseach other and on themselves

Page 38: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

38

C : Client

: Transaction

1 : <<create>>

p : ODBCProxy

2 : setActions(a, d, o)

2.1 : setValues(d, 3, 4)

2.2 : setValues(a, “CO”)

3 : <<destroy>>

<<local>><<global>>

objects

link

path stereotype

sequence number

message

Example of a collaboration diagram

Page 39: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

39

A communication may also show A communication may also show iteration and branchingiteration and branching To model an iteration, prefix the To model an iteration, prefix the

sequence number of a message with sequence number of a message with an expression that begins with *, e.g. an expression that begins with *, e.g. *[ i := 1..n ], or with just an **[ i := 1..n ], or with just an *

To model a condition, prefix the To model a condition, prefix the sequence number of a message with a sequence number of a message with a condition clause, e.g [ x > 0 ]condition clause, e.g [ x > 0 ]

Page 40: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

40

Semantic Equivalence Semantic Equivalence Both sequence and communication Both sequence and communication

diagrams are semantically equivalentdiagrams are semantically equivalent A sequence diagram can be converted A sequence diagram can be converted

into a communication diagram, and vice into a communication diagram, and vice versa, without any loss of informationversa, without any loss of information

However, this does not mean that both However, this does not mean that both diagrams will explicitly visualize the diagrams will explicitly visualize the same informationsame information

Page 41: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

41

C : Client

: Transaction

p : ODBCProxy

X

setActions(a, d, o)setValues(d, 3, 4)

setValues(a, “CO”)

committed

C : Client

: Transaction

1 : <<create>>

p : ODBCProxy

2 : setActions(a, d, o)

2.1 : setValues(d, 3, 4)

2.2 : setValues(a, “CO”)

3 : <<destroy>>

<<local>><<global>>

semantically equivalent

transaction

Page 42: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

42

You built sequence diagrams or You built sequence diagrams or communication diagrams from the use-case communication diagrams from the use-case and class diagrams that were built before.and class diagrams that were built before. Each use cases in a use-case diagram has its Each use cases in a use-case diagram has its

corresponding sequence or communication corresponding sequence or communication diagramdiagram

You model the diagrams from the main flow of You model the diagrams from the main flow of events, or the alternate flow of events, or the events, or the alternate flow of events, or the scenarios, of each use casescenarios, of each use case

Every object that you have identified in the Every object that you have identified in the sequence or communication diagram, MUST sequence or communication diagram, MUST have its corresponding class in the class have its corresponding class in the class diagramdiagram

Page 43: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

43

Example: - Modelling a sequence diagram for the Example: - Modelling a sequence diagram for the log-in use case from the on-line Bookstore Case log-in use case from the on-line Bookstore Case Study.Study. The main-flow of events that are involved is: -The main-flow of events that are involved is: -

1. The CUSTOMER clicks the Log-in button on the Home Page.1. The CUSTOMER clicks the Log-in button on the Home Page.

2. The system displays the Log-in Page.2. The system displays the Log-in Page.

3. The CUSTOMER enters his/her user ID and password. The 3. The CUSTOMER enters his/her user ID and password. The

CUSTOMER clicks the OK button.CUSTOMER clicks the OK button.

4. The system validates the log-in information against the ACCOUNT 4. The system validates the log-in information against the ACCOUNT

table in the database.table in the database.

5. CUSTOMER is an authorised user; the system displays the Personal 5. CUSTOMER is an authorised user; the system displays the Personal

Home Page to the CUSTOMERHome Page to the CUSTOMER

Page 44: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

44

Actors: CustomerActors: Customer Messages and ObjectsMessages and Objects

1. The CUSTOMER 1. The CUSTOMER clicks the Log-in buttonclicks the Log-in button on on the the Home PageHome Page..

2. The system 2. The system displaysdisplays the the Log-in PageLog-in Page..3. The CUSTOMER 3. The CUSTOMER enters his/her user ID and enters his/her user ID and

passwordpassword. The. The CUSTOMER clicks the CUSTOMER clicks the OK buttonOK button..

5. The system 5. The system validatesvalidates the log-in information the log-in information against theagainst the

ACCOUNTACCOUNT tabletable in the database. in the database.6. CUSTOMER is an authorised user; the 6. CUSTOMER is an authorised user; the

system system displaysdisplays the the Personal Personal Home PageHome Page to the CUSTOMER to the CUSTOMER

Page 45: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

45

:HomePage :LoginPage :Account:Customer

clickLogin( )

display( )

enter userID and password

clickOK( )validateLogin(userID, password)

login OK

display( )

The Customer clicks the Login button on the Home Page

The system displays the Login Page

The Customer enters his or her user ID and password, and then clicks the OK button.

The system validates the login information against the persistent Account data …

… and then returns the Customer to the Home Page.

Sequence Diagram

Page 46: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

46

:HomePage

:LoginPage:Account

:Customer

1 : clickLogin( )

3 : enter userID and password4 : clickOK( )

2 : display( )6 : display( )

5 : validateLogin(userID, password)

Communication Diagram

Page 47: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

47

Robustness AnalysisRobustness Analysis Sometimes when drawing an interaction diagram, we Sometimes when drawing an interaction diagram, we

may be confused about the objects that are involved.may be confused about the objects that are involved. Because each object that we use in an interaction Because each object that we use in an interaction

diagram MUST have its corresponding classes in the diagram MUST have its corresponding classes in the class diagram, we may find ourselves in a situation class diagram, we may find ourselves in a situation where we have already determined the objects that are where we have already determined the objects that are needed in an interaction diagram but the objects do not needed in an interaction diagram but the objects do not have their corresponding classes in our class diagram.have their corresponding classes in our class diagram. In the previous example, we discovered that the only object in In the previous example, we discovered that the only object in

the interaction diagrams that has its corresponding class in the the interaction diagrams that has its corresponding class in the class diagram in Account.class diagram in Account.

There is no HomePage and Log-in Page class in the class There is no HomePage and Log-in Page class in the class diagram (refer to Case Study in Chapter 5)diagram (refer to Case Study in Chapter 5)

To solve this problem, we can perform robustness To solve this problem, we can perform robustness analysisanalysis

Page 48: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

48

Robustness analysis involves analysing the Robustness analysis involves analysing the text of a use case and identifying a first-text of a use case and identifying a first-guess set of guess set of objectsobjects that will participate in that will participate in the use case, and then the use case, and then classifyingclassifying these these objects based on their objects based on their characteristicscharacteristics.. It involves defining analysis classesIt involves defining analysis classes

There are 3 types of analysis classes:There are 3 types of analysis classes: boundary classesboundary classes entity classesentity classes control classescontrol classes

Instances of each of these analysis classes are Instances of each of these analysis classes are called objects.called objects.

Page 49: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

49

Boundary objectsBoundary objects is an object with which an actor is an object with which an actor

associated with a use case interacts.associated with a use case interacts. if the actor is human, the boundary object if the actor is human, the boundary object

may be a window, screen, dialog box, or may be a window, screen, dialog box, or menumenu

if the actor is non-human, the boundary if the actor is non-human, the boundary object may be application program object may be application program interfaces (APIs)interfaces (APIs)

boundary object

Page 50: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

50

Entity objectsEntity objects is an object that contains long-lived is an object that contains long-lived

information, such as that associated information, such as that associated with databases.with databases. will be mapped to a table (part of the will be mapped to a table (part of the

database) in the design phasedatabase) in the design phase It can also contain transient objects, i.e. It can also contain transient objects, i.e.

contents of lists in windows, or search contents of lists in windows, or search results.results.

entity object

Page 51: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

51

Control objectsControl objects is an object that embodies application logicis an object that embodies application logic correspond with system actions (not actions taken by correspond with system actions (not actions taken by

actors)actors) are often used to handle things such as coordination and are often used to handle things such as coordination and

sequencingsequencing are also useful for calculations involving multiple entity objectsare also useful for calculations involving multiple entity objects

will be mapped to codes during implementation phasewill be mapped to codes during implementation phase used as a connecting tissue between boundary objects used as a connecting tissue between boundary objects

and entity objects.and entity objects.

control object

Page 52: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

52

Using the previous example (the log-in use Using the previous example (the log-in use case of the Online Bookstore), we can identify case of the Online Bookstore), we can identify that the HomePage and Log-in Page objects that the HomePage and Log-in Page objects are boundary objects, whereas the Account are boundary objects, whereas the Account object is an entity object. Therefore, taking object is an entity object. Therefore, taking this into account, we can draw a new this into account, we can draw a new interaction diagram.interaction diagram.

We need to also modify our previous class We need to also modify our previous class diagram to reflect this changes.diagram to reflect this changes. Analysing our previous class diagram, we would Analysing our previous class diagram, we would

realised that we have only included entity objects.realised that we have only included entity objects. We now need to also include our boundary objects.We now need to also include our boundary objects. The changes is reflected in the Case StudyThe changes is reflected in the Case Study

Page 53: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

53

:HomePage :LoginPage :Account:Customer

clickLogin( )

display( )

enter userID and password

clickOK( )validateLogin(userID, password)

login OK

display( )

The Customer clicks the Login button on the Home Page

The system displays the Login Page

The Customer enters his or her user ID and password, and then clicks the OK button.

The system validates the login information against the persistent Account data …

… and then returns the Customer to the Home Page.

Sequence Diagram

Page 54: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

54

:HomePage

:LoginPage:Account

:Customer

1 : clickLogin( )

3 : enter userID and password4 : clickOK( )

2 : display( )6 : display( )

5 : validateLogin(userID, password)

Communication Diagram

Page 55: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

55

Expressing time on Expressing time on Interaction DiagramInteraction Diagram

It is often useful to enhanced interaction It is often useful to enhanced interaction diagram by specifying time-related diagram by specifying time-related requirements, esp. when the system being requirements, esp. when the system being modelled involves real-time operation or modelled involves real-time operation or geographic distribution.geographic distribution.

The UML defines the following time The UML defines the following time specific term: -specific term: - Time expressionTime expression Timing markTiming mark Timing constraintTiming constraint

Page 56: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

56

Definitions: -Definitions: - A time expression is an expression A time expression is an expression

that resolves to a relative or absolute that resolves to a relative or absolute value of time once it’s evaluatedvalue of time once it’s evaluated

A timing mark is a time related name A timing mark is a time related name or label on a messageor label on a message

A timing constraint is a condition that A timing constraint is a condition that must be satisfied with regard to time. must be satisfied with regard to time. It usually containsIt usually contains a time expressiona time expression a timing marka timing mark

Page 57: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

57

There exist a timing mark on the message validateLogin(…). There exist a timing mark on the message validateLogin(…). The timing constraint in the above example, uses a timing The timing constraint in the above example, uses a timing

mark (v) and a time expression (executionTime < 3).mark (v) and a time expression (executionTime < 3).

: LoginPage : Account v : validateLogin(userID, password)

{ v.executionTime < 3 sec}

timing mark

time expression

timing constraint

Example: - Timing on a Sequence diagram

Page 58: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

58

Timing DiagramTiming Diagram

Timing diagrams are another form of Timing diagrams are another form of interaction diagram, where the focus is on interaction diagram, where the focus is on timing constraints: either for a single object timing constraints: either for a single object or, more usefully, for a bunch of objects.or, more usefully, for a bunch of objects.

When to use timing diagram?When to use timing diagram? Timing diagrams are useful for showing timing Timing diagrams are useful for showing timing

constraints between state changes on different constraints between state changes on different objects. objects.

The diagrams are particularly familiar to The diagrams are particularly familiar to hardware engineers.hardware engineers.

Page 59: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

59

Graphic nodes and pathsGraphic nodes and paths FrameFrame

NotationNotation Focuses on the observable exchange of Focuses on the observable exchange of

information between connectable elements.information between connectable elements. MessageMessage

NotationNotation Messages come in different variants Messages come in different variants

depending on what kind of Message they depending on what kind of Message they convey.convey.

There are 5 types of messages in this diagram.There are 5 types of messages in this diagram.

Page 60: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

60

1.1. Asynchronous MessagesAsynchronous Messages

2.2. Synchronous MessagesSynchronous Messages

3.3. Object creation MessageObject creation Message

4.4. Lost MessagesLost Messages

5.5. Found MessagesFound Messages Message LabelMessage Label

NotationNotation Labels are only notational shorthands used to Labels are only notational shorthands used to

prevent cluttering of the diagrams with a number prevent cluttering of the diagrams with a number of messages crisscrossing the diagram between of messages crisscrossing the diagram between Lifelines that are far apart.Lifelines that are far apart. The labels denote that a message may be disrupted The labels denote that a message may be disrupted

by introducing labels with the same name.by introducing labels with the same name.

Page 61: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

61

State or condition timelineState or condition timeline Notation Notation This is the state of the classifier or This is the state of the classifier or

attribute, or some testable condition, such attribute, or some testable condition, such as an discrete enumerable value. It is also as an discrete enumerable value. It is also permissible to let the state-dimension be permissible to let the state-dimension be continuous as well as discrete. This is continuous as well as discrete. This is illustrative for scenarios where certain illustrative for scenarios where certain entities undergo continuous state changes, entities undergo continuous state changes, such as temperature or density.such as temperature or density.

initialisingacquiringreportingidle

Page 62: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

62

General value lifelineGeneral value lifeline NotationNotation Shows the value of the connectable element Shows the value of the connectable element

as a function of time. Value is explicitly as a function of time. Value is explicitly denoted as text. Crossing reflects the event denoted as text. Crossing reflects the event where the value changed.where the value changed.

LifelineLifeline GeneralOrderingGeneralOrdering

NotationNotation To describe that one occurrence must occur To describe that one occurrence must occur

before the other in a valid trace.before the other in a valid trace. Destruction EventDestruction Event

On Off

Page 63: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

63

ExampleExample

Page 64: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

64

Page 65: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

65

SummarySummary No single interaction diagram can No single interaction diagram can

capture everything about a system’s capture everything about a system’s dynamic aspectdynamic aspect may need to use many interaction may need to use many interaction

diagrams to model the dynamic aspects diagrams to model the dynamic aspects of a system as a whole, as well as its of a system as a whole, as well as its subsystem, operations, classes, use subsystem, operations, classes, use cases and collaborations.cases and collaborations.

Page 66: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

66

To model a sequence diagram: -To model a sequence diagram: - Set the context for the interactionSet the context for the interaction

Whether it is a system, subsystem, operation, class or a Whether it is a system, subsystem, operation, class or a scenario of a use case or collaborationscenario of a use case or collaboration

Identify which objects play a role in the Identify which objects play a role in the interactioninteraction

Place them from left-to-right, at the top of the diagramPlace them from left-to-right, at the top of the diagram Set the lifeline for each objectSet the lifeline for each object Starting with the message that initiates the Starting with the message that initiates the

interaction, layout each subsequent message interaction, layout each subsequent message from top to bottom between each lifelinesfrom top to bottom between each lifelines

May adorn each object’s lifeline with its focus of controlMay adorn each object’s lifeline with its focus of control May also adorn each message with a timing mark and May also adorn each message with a timing mark and

attach suitable time or space constraintsattach suitable time or space constraints May also attach pre or post-conditions to each messageMay also attach pre or post-conditions to each message

Page 67: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

67

To model a communication diagram: -To model a communication diagram: - Set the context for the interactionSet the context for the interaction

Whether it is a system, subsystem, operation, class or a Whether it is a system, subsystem, operation, class or a scenario of a use case or communicationscenario of a use case or communication

Identify which objects play a role in the Identify which objects play a role in the interactioninteraction

Place them as vertices in the graphPlace them as vertices in the graph May set the initial properties (e.g attribute values, tagged May set the initial properties (e.g attribute values, tagged

values, state or role) for each of the objectvalues, state or role) for each of the object Specify the links among these objects, along which Specify the links among these objects, along which

messages may be passedmessages may be passed Starting with the message that initiates the Starting with the message that initiates the

interaction, attach each subsequent message to interaction, attach each subsequent message to the appropriate link, setting its sequence number the appropriate link, setting its sequence number as appropriateas appropriate

May also adorn each message with a timing mark and May also adorn each message with a timing mark and attach suitable time or space constraintsattach suitable time or space constraints

May also attach pre or post-conditions to each messageMay also attach pre or post-conditions to each message

Page 68: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

Case Study: On-Case Study: On-Line Bookstore Line Bookstore

(cont…)(cont…)

Page 69: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

69

On-line Bookstore is a web application that On-line Bookstore is a web application that can be accessed by the store’s registered can be accessed by the store’s registered customer, whereby each customer can order customer, whereby each customer can order books, review one or more books sold in the books, review one or more books sold in the book store, and sell used books to other book store, and sell used books to other customers. Before performing any one of customers. Before performing any one of these transactions, the customer must first these transactions, the customer must first log-in into the system using their user id and log-in into the system using their user id and password kept in their account. password kept in their account.

ProblemProblem: Draw the sequence diagram for the : Draw the sequence diagram for the above systemabove system

Page 70: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

70

we know that the functional requirements we know that the functional requirements for the Online Bookstore can be seen from for the Online Bookstore can be seen from the use case diagram (as shown in the the use case diagram (as shown in the next slide)next slide) Each of the use cases in the use case diagram Each of the use cases in the use case diagram

must have its corresponding interaction must have its corresponding interaction diagramdiagram

We will use the scenarios in the ‘Main flow of We will use the scenarios in the ‘Main flow of events’ for each use case to model the events’ for each use case to model the interaction diagraminteraction diagram

Remember that each object MUST have its Remember that each object MUST have its corresponding classes in the class diagramcorresponding classes in the class diagram

Page 71: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

71

RegisterRegister

Order booksOrder books

Sell used Sell used booksbooks

Review booksReview books

CustomeCustomerr

On-line Bookstore On-line Bookstore SystemSystem

Log-inLog-in

<<include<<include>>>>

<<include<<include>>>>

<<include<<include>>>>

Check outCheck out<<extend<<extend

>>>>(CustID)(CustID)

Use Case Use Case Functional Functional

Requirements Requirements DiagramDiagram

Page 72: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

72

CustomerCustomer userId: userId: StringString name: name: StringString e-mail: e-mail: StringString

… …

BookBook bookId: bookId: StringString title: Stringtitle: String

… …

OrderOrder orderId: orderId: StringString bookId: bookId: StringString userId: userId: StringString quantity: quantity: IntegerInteger status: status: StringString

ReviewReview bookId: bookId: StringString review: review: StringString

… … calcAvgRatincalcAvgRating()g()

UsedBookUsedBook userId: userId: StringString quality: quality: StringString

… …

AccountAccount userId: userId: StringString password: password: StringString checkPasswocheckPassword()rd()

has

sel

l

mak

e

ord

er

has

11..*

1..*

1..*

1..*

1

1

1..*

1..*

1

Page 73: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

73

:HomePage :LoginPage :Account:Customer

clickLogin( )

display( )

enter userID and password

clickOK( )validateLogin(userID, password)

login OK

display( )

The Customer clicks the Login button on the Home Page

The system displays the Login Page

The Customer enters his or her user ID and password, and then clicks the OK button.

The system validates the login information against the persistent Account data …

… and then returns the Customer to the Home Page.

Log-inLog-in

Page 74: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

74

Use Case: RegisterUse Case: Register Main flow of events:Main flow of events:

1. The CUSTOMER clicks the REGISTER button on the Home Page.1. The CUSTOMER clicks the REGISTER button on the Home Page.2. The system displays the Register Page.2. The system displays the Register Page.3. The CUSTOMER enters all of the required information.3. The CUSTOMER enters all of the required information.4. The CUSTOMER clicks the SEND button.4. The CUSTOMER clicks the SEND button.5. The system checks that all of the required information were 5. The system checks that all of the required information were entered. If entered. If

yes, the system update the CUSTOMER’s record in the yes, the system update the CUSTOMER’s record in the CUSTOMER CUSTOMER

and ACCOUNT tables in the database. System displays OK and ACCOUNT tables in the database. System displays OK message.message. Objects:-Objects:-

CUSTOMER: actorCUSTOMER: actor CUSTOMER and ACCOUNT: entity objectsCUSTOMER and ACCOUNT: entity objects Home Page and Register Page: boundary objectsHome Page and Register Page: boundary objects

Page 75: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

75

:HomePage :RegisterPage

:Account

:Customer

clickRegister( )

display( )

enter information

clickSEND( ) verify info

display( )

The customer clicks the REGISTER button on the Home Page

The system displays the Register Page

The Customer enters the required information and then clicks the SEND button.

The system checks that all of the required information were entered. If yes, the system updates the CUSTOMER’s record in the CUSTOMER and ACCOUNT tables in the database. The system displays OK message

RegisterRegister

:Customer

create

create

Page 76: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

76

Case Study: Order BooksCase Study: Order Books Main Flow of events: -Main Flow of events: -

1. The CUSTOMER enters the keyword for a book and 1. The CUSTOMER enters the keyword for a book and clicks the clicks the

SEARCH button on the personal Home Page.SEARCH button on the personal Home Page.2. The system displays the matching books on the web 2. The system displays the matching books on the web

Page.Page.3. The CUSTOMER chooses the desired book and clicks 3. The CUSTOMER chooses the desired book and clicks

the ADD TO the ADD TO SHOPPING CART button on the web page. SHOPPING CART button on the web page. 4. The system adds the book into the CUSTOMER’s Order 4. The system adds the book into the CUSTOMER’s Order

table in the table in the database. database.

Objects:Objects: Customer: actorCustomer: actor Home Page: boundary objectHome Page: boundary object Book and Order: entity objectBook and Order: entity object

Page 77: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

77

:HomePage :Book :Order:Customer

enters keyword

search( )

choose books

The CUSTOMER enters the keyword for a book and clicks the SEARCH button on the personal Home Page

The system displays the matching books on the web Page

The CUSTOMER chooses the desired book and clicks the ADD TO SHOPPING CART button on the web page.

The system adds the book into the CUSTOMER’s Order table in the database.

Order Order booksbooks

clickSearch( )

displayMatch( )

clickAdd()

create

addBook( )

Page 78: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

78

Use Case: Check-outUse Case: Check-out Main flow of eventsMain flow of events

1. The CUSTOMER clicks the Check out button on the Home Page1. The CUSTOMER clicks the Check out button on the Home Page2. The system displays the books in the ORDER table of the 2. The system displays the books in the ORDER table of the

CUSTOMER onCUSTOMER on the web Page.the web Page.3. The CUSTOMER checks the order list for any inconsistency. If 3. The CUSTOMER checks the order list for any inconsistency. If

nothing was nothing was found, CUSTOMER clicks the PROCEED button. found, CUSTOMER clicks the PROCEED button. 4. The system displays the Invoice page.4. The system displays the Invoice page.5. The Customer enters the relevant credit card information and clicks 5. The Customer enters the relevant credit card information and clicks

OK. OK. 6. The system checks that the credit card is valid. Then, the system 6. The system checks that the credit card is valid. Then, the system

displays the displays the Delivery Details page.Delivery Details page.

7. The CUSTOMER chooses destination for delivery, along with 7. The CUSTOMER chooses destination for delivery, along with deliverydelivery

options. Then, he/she clicks the PROCEED button. options. Then, he/she clicks the PROCEED button. 8. The system will display the check-out information for confirmation.8. The system will display the check-out information for confirmation.7. The CUSTOMER checks that all information is correct and then 7. The CUSTOMER checks that all information is correct and then

clicks theclicks the OK button. OK button. 8. The system sends a confirmation via CUSTOMER’s e-mail.8. The system sends a confirmation via CUSTOMER’s e-mail.

Objects: -Objects: - Home Page, Invoice Page and Delivery Page: boundary objectsHome Page, Invoice Page and Delivery Page: boundary objects Customer and Order: entity objectsCustomer and Order: entity objects

Page 79: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

79

:HomePage :Customer:Customer

clickCheckOut( )retrieve()

display( )

:Order

display( )

verify info

clickProceed( )

:InvoicePage

clickOK() validate( )

:DeliveryPage

display( )

enter credit card info

clickOK()

choose destination

display()

confirm and clickOK ()

Page 80: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

80

Use case: Sell used booksUse case: Sell used books Main flow of events: -Main flow of events: -

1. The CUSTOMER clicks the Sell Used Books button on the 1. The CUSTOMER clicks the Sell Used Books button on the Home Home

Page.Page.2. The system displays the sell used books web page.2. The system displays the sell used books web page.3. The CUSTOMER enters the required information on the used 3. The CUSTOMER enters the required information on the used

books books that he/she wants to sell. that he/she wants to sell. 4. The CUSTOMER clicks the SEND button on the webpage.4. The CUSTOMER clicks the SEND button on the webpage.5. The system displays a confirmation page listing the information 5. The system displays a confirmation page listing the information

that that the CUSTOMER has entered. the CUSTOMER has entered. 6. The CUSTOMER checks that the information displayed are 6. The CUSTOMER checks that the information displayed are

accurate. accurate. If yes, the CUSTOMER clicks the OK button on the web page.If yes, the CUSTOMER clicks the OK button on the web page.7. The system updates the USED BOOKS table in the database.7. The system updates the USED BOOKS table in the database.

Objects:Objects: Home Page, Used Books Page and Confirmation Page: boundary Home Page, Used Books Page and Confirmation Page: boundary

objectsobjects Customer and Used Books: entity objectsCustomer and Used Books: entity objects

Page 81: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

81

:HomePage :UsedBooksPage

:Customer:Customer

clickUsedBooks( )

display( )

enter book info

clickSend( )

verify info

Sell used Sell used booksbooks

:UsedBook:ConfPage

display( )

clickOK( )

add( )

add( )

Page 82: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

82

Use case: ReviewUse case: Review Main flow of events: -Main flow of events: -

1. The CUSTOMER enters the keyword to search for a book and 1. The CUSTOMER enters the keyword to search for a book and then then

clicks the SEARCH button on the Personal Web Page.clicks the SEARCH button on the Personal Web Page.2. The system displays the matching books on the web Page.2. The system displays the matching books on the web Page.3. The CUSTOMER checks for the desired book and clicks on the 3. The CUSTOMER checks for the desired book and clicks on the chosen book icon. chosen book icon. 4. The system displays the book’s detail in the Book Detail web 4. The system displays the book’s detail in the Book Detail web

page.page.5. The CUSTOMER clicks the REVIEW button on the web page.5. The CUSTOMER clicks the REVIEW button on the web page.6. The system displays the Review Book web page.6. The system displays the Review Book web page.7. The CUSTOMER clicks on the desired star button and the 7. The CUSTOMER clicks on the desired star button and the

click the click the OK button on the web page.OK button on the web page.8. The system calculates the overall rating of the book and 8. The system calculates the overall rating of the book and

updates the updates the Book table in the database.Book table in the database.9. The system displays the Book Detail web pages that have 9. The system displays the Book Detail web pages that have

been been updated.updated.

Objects?Objects? Diagram?Diagram?

Page 83: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

83

The class diagram that was built before The class diagram that was built before needs to be changed in order to reflect needs to be changed in order to reflect the changes that took place.the changes that took place. We need to add the boundary objects into We need to add the boundary objects into

the class diagram, and also the relationships the class diagram, and also the relationships between the old objects and the added ones.between the old objects and the added ones.

Each operations performed in the sequence Each operations performed in the sequence diagram must be shown in the respective diagram must be shown in the respective classesclasses

Each data entered must also be shown in the Each data entered must also be shown in the respective classesrespective classes

Page 84: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

84

The objects identified: -The objects identified: - Entity objects:Entity objects:

Account, Customer, Book, Used Book, Account, Customer, Book, Used Book, Order, ReviewOrder, Review

Boundary objectsBoundary objects Home Page, Log-in Page, Register Page, Home Page, Log-in Page, Register Page,

Invoice Page, Delivery Page, Used Book Invoice Page, Delivery Page, Used Book Page, Confirm Page, Book Detail Page and Page, Confirm Page, Book Detail Page and Review PageReview Page

The The modified class diagram

Page 85: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

85

Page 86: Software Engineering Design & Modeling Sequence Diagram Communication Diagram Communication Diagram Timing Diagram Timing Diagram

The EndThe End