Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models...

83
Introduction to Sequence Introduction to Sequence Diagrams Diagrams

Transcript of Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models...

Page 1: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Introduction to Sequence Introduction to Sequence DiagramsDiagrams

Page 2: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The VisionThe Vision

SSM Models

Use Cases

Activity Models

Dynamic Models

ObjectModels

Programs

Databases

BusinessComputing

Page 3: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Beginnings of a MethodBeginnings of a Method

Soft Systems

Model

Page 4: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Systems ActivitiesSystems Activities

• The systems functionality is represented as a number of Use Cases

• The functionality of each use case will be realised through objects collaborating with each other

• Collaboration is achieved through message passing

Page 5: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Message ConnectionsMessage Connections

• The arrow indicates that:

– The sender sends a message

– The receiver receives the message

– The receiver takes some action, returning the result to the sender

ReceiverSender

Page 6: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Message ConnectionsMessage Connections

Receiver

Sender

Operation X

Operation X

• The message must activate an operation in the receiving object

Page 7: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Message ConnectionsMessage Connections

There are two ways of knowing which object to send a

message to:

(1) An association exists between sender and receiver in the object model

(2) The receiver’s object id is passed as part of the message (i.e. as a parameter)

Page 8: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Message ConnectionsMessage Connections

Sequence Diagrams allow us to describe object communication associated with a specific use case

• Can be used:

– during analysis to help define an object's responsibilities

– as documentation for the final implemented software

Page 9: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Example Object ModelExample Object Model

Page 10: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence Diagram for Placing an Sequence Diagram for Placing an OrderOrder

Description

Create Order

Get Customer Details

Insert order line item

Issue stock item

Get order line cost

Get total order cost

Order

Order

Customer

Customer

Order Line Item

Order Line Item

Stock Item

Stock Item

Customer Places Order

.

.

.

.

.

.

Page 11: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Placing an OrderPlacing an Order

• A message is sent to the order class to create a new “order”

– Customer No., Stock items and Quantities are passed as parameters

– Customer details are retrieved from the appropriate customer object

– For each stock item an order line object is created

» Details are extracted from the stock item object

Page 12: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Another Example - A LibraryAnother Example - A Library

We have identified three objects: Borrower, Book and Librarian and

the following relationship:

Borrower Book0..1

n

Page 13: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Library ExampleLibrary Example

Issuing a Loan

Triggered by a request from a Borrower for

the loan of a Book.

Before issuing the loan we need to check:

Page 14: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Library ExampleLibrary Example

1) The borrower has no overdue fines

2) The borrower has not already reached the maximum number of loans that they are allowed.

3) None of the borrower’s current loans are overdue

Page 15: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Issue Loan - Sequence Diag.Issue Loan - Sequence Diag.

Description

Issue Loan

Check Borrower LoanStatus

Check Fines Owing

Check No of CurrentLoans

Check no. of OverdueLoans

If Borrower Loan Status OKThen

Issue Book to Borrower

Update Book Details(Borrower No, DateDue)

Add Book to BorrowerList

End IF

Librarian

Librarian

Borrower

Borrower

Book

Book

Issue Loan

IssueLoan

CheckLoanStatus

Check ifoverdue

Issue to Borrower

Add Book toLoan List

Page 16: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Library ExampleLibrary Example

Our object model must be consistent with the

interaction diagram

Borrower

Fines OwingMax. No. of LoansAdd Book to Loan ListCheck Loan Status

Book

Borrower No.Date DueCheck if overdueIssue to Borrower

Librarian

Issue Loan

0..1

n

Page 17: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Library ExampleLibrary Example

Each of the operations in our model needs to

be documented with pseudocode

e.g.

Borrower::Add Book to Loan List– Receives a book id and then adds this to the collection of books

linked to borrower

Page 18: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

An Example ProgramAn Example Program

Page 19: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Another StudentAnother Student

Page 20: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The Underlying DatabaseThe Underlying Database

Page 21: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The Program that uses the The Program that uses the DatabaseDatabase

Page 22: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The Class DiagramThe Class Diagram

Group

Student

n

Module Work Recordn1

n

n1

Page 23: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

System Boundary

Group Student

Get Group Student Numbers

Get Student Number

Page 24: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

System Boundary

Group Student Module Results

Get Student Marks

Get Module Results

Page 25: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Three TiersThree Tiers

Group

Student

n

Module Work Recordn1

n

n1

Page 26: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

ExerciseExercise

Each Instructor has a name, address and telephone number and is qualified to present one or more courses.

We store the date when the instructor became qualified to teach the course

A course has at least one instructor qualified to teach it but it may have many 

Each course has a number, title and a date of next revision

Each course will have several scheduled presentations

Details of the date, duration and location are recorded for each presentation

Each presentation will be given by only one instructor but one instructor may give many presentations

Page 27: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The “Reschedule Presentation” use case 

Sometimes a presentation needs to be rescheduled when this happens the availability of the existing instructor needs to be checked. If they are available they are assigned to the presentation on the new date. If not we need to release the current instructor, find all other qualified instructors and check their availability to identify a replacement .

Page 28: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Use Case – Reschedule PresentationUse Case – Reschedule PresentationInitial Class DiagramInitial Class Diagram

Presentation

Course

Instructor

Qualification

1

1..n1 1..n

1

0..n

10..n

Page 29: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

After much discussion…After much discussion…

System Boundary

: Presentation : Instructor : Course : Qualification

Page 30: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

System Boundary

: Presentation : Instructor : Qualification : Course

RescheduleCheck Availability

Get Qualified Instructors Get Instructor

Return Instructor Details

Check Availability

Page 31: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Developing Sequence DiagramsDeveloping Sequence Diagrams

• Identify the relevant objects involved in the computation

• Establish the role of each object

• Identify the controller

• Identify the collaborators

• Decide on the messages between objects

Page 32: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence diagram notationSequence diagram notation

Actors

:Object 1 :Object 2

Objects

Page 33: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence diagram notationSequence diagram notation

:Object 1 :Object 2

Lifelines

Identify the existence of the object over time.

Page 34: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence diagram notationSequence diagram notation

:Object 1 :Object 2

Activations

Indicate when an object is performing an action

Page 35: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence diagram notationSequence diagram notation

:Object 1 :Object 2

message

Messages

Indicate the communications between objects

Page 36: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence diagram notationSequence diagram notation

:Object 1 :Object 2

message

Sequence

Vertical position signifies sequence – earlier messages appear nearer the top.

message

Page 37: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence DiagramSequence Diagram

• Tracks a sequence of events in a scenario

• Identifies all objects involved

ObjectsO1 O2 O3 O4 O5

Events

E1

E2

E3

E4

indicatesthat theeventeffects theobject

Page 38: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence modellingSequence modelling

For each event, ask “what objects does this involve?”

– Used to identify new classes

– Determines how classes interact

Page 39: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Use case elaborationUse case elaboration

• We define use cases as sequences - primary and alternative paths

• Now we take sample sequences and build sequence diagrams

• This gives us the objects

• And it gives us the relationships

• And it gives us the operations

Page 40: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Invoicing use case (1)Invoicing use case (1)

Use Case Number: 99 Use Case Name: Invoice Customer Brief Description: This is run daily to send invoices to customers. Items that have been delivered are billed all on the same invoice. Customers are only billed once a month. Actors: Daily batch run, customer (indirectly, through post) Frequency of Execution: Daily Scalability: Only one instance of this runs at any one time. Criticality: Essential. Every days delay to printing invoices affects the bank balance considerably. Not running this for 7 days could trigger a serious cash flow problem. Primary Path: The following sequence is carried out for every customer on the sales ledger who has not been billed in the last month: 1. Get sales items from the sales ledger. 2. Get customer details from the customer file, covering billing address details. 3. Get any credits that the customer has. 4. Get discount details for customer. 5. Print the invoice header 6. Print the line items on the invoice 7. Calculate any discounts 8. Apply any credits 9. Calculate and print the invoice total 10. Calculate and print the VAT 11. Mark items on sales ledger as invoiced

Page 41: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Invoicing use case (2)Invoicing use case (2)

Use Cases Related to Primary Path: Alternatives:2.1 No customer details on customer file, so print an error message on areport. Do not mark the items on the sales ledger as invoiced. Themessage needs to detail the sales items that have been entered.Use Cases Related to Alternatives:Invoicing error reportExceptions: Use Cases Related to Exceptions: Notes:

Page 42: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The Primary PathThe Primary Path

The following sequence is carried out for every customer on the sales ledger who has not been billed in the last month:

1. Get sales items from the sales ledger.

2. Get customer details from the customer file, covering billing address details.

3. Get any credits that the customer has.

4. Get discount details for customer.

5. Print the invoice header

6. Print the line items on the invoice

7. Calculate any discounts

8. Apply any credits

9. Calculate and print the invoice total

10. Calculate and print the VAT

11. Mark items on sales ledger as invoiced

Page 43: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Now we can realise the use caseNow we can realise the use case

• Elaborate the scenario with sequence diagrams

• Find objects

• Add operations to objects

• Add attributes to objects

Page 44: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice In recent years many OO gurus have suggested that we should introduce a control class for each Use Case.

The control class drives the processing.

For interactive use cases there is usually a boundary class too.

We can put this object in a class diagram

Sequence diagram for Print Invoice Sequence diagram for Print Invoice useuse casecase

Page 45: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Print Invoice From our sequence diagram, we find our first object!

Page 46: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Customer Record

Get Customer Name

Now we implement the first step of the scenario by getting the Print Invoice control class to send a message.

And then we need a recipient of the message.

So we have found another object

Page 47: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Print Invoice Customer Record

We can see that as the objects communicate we need a relationship between them.

Page 48: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Invoice : Customer Record

Get Customer Name

Print Customer Name

Moving on to the next step of the scenario

We now have a third object!

Page 49: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Invoice

Print Invoice Customer Record

Now we add in our third object

And because the message comes from Print Invoice to Invoice, they need to be related

Page 50: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Sales Items : Invoice : Customer Record

Get Customer Name

Print Customer Name

Get Customer Address

Print Customer Address

Get Unbilled Invoicable Items

Print Invoice Lines

Print Total

Print Terms and Conditions

So we continue!

Page 51: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Sales Items Invoice

Print Invoice Customer Record

We need one more object

Which is related to Print Invoice

Page 52: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

So what have we done?So what have we done?

• Worked through a Use Case scenario step by step

• Introduced a controller object to drive things

• Sent messages from one object to another

• Found objects to deal with the messages

• Put the objects and necessary relationships on a

class diagram

Page 53: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

What have we got left to do?What have we got left to do?

• Find operations on objects to support the messages

• Find attributes to support the objects

Page 54: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Sales Items : Invoice : Customer Record

GetName( )

So we work through the messages and apply operations

Page 55: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Sales ItemsInvoice

Print InvoiceCustomer Record

GetName()

And then we have an operation for our class diagram

Page 56: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Sales Items : Invoice : Customer Record

PrintCustName( )

GetName( )

And so we continue

Page 57: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Sales ItemsInvoice

PrintCustName()

Print InvoiceCustomer Record

GetName()

And we add the next operation to the class diagram

Page 58: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: Print Invoice : Sales Items : Invoice : Customer Record

GetUnbilledItems( )

PrintCustName( )

PrintCustAddress( )

PrintLines( )

PrintTotal( )

PrintTermsConditions( )

GetName( )

GetAddress( )

And all the way through the sequence diagram

Page 59: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Print Invoice - class diagramPrint Invoice - class diagram

Sales Items

getItems()GetUnbilledItems()

Invoice

PrintCustName()PrintCustAddress()PrintLines()PrintTotal()PrintTermsConditions()

Print Invoice

Print()

Customer Record

GetName()GetAddress()

And then add the other operations to the class diagram

We can put an operation on Print Invoice to implement this

Page 60: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

A Simpler Example - Sending an emailA Simpler Example - Sending an email

Page 61: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

E-mail interfaceE-mail interface

Page 62: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Working from a scenarioWorking from a scenario

Sending an email

1. Press “New ” email icon

2. Enter person’s name in “To” section

3. Type subject

4. Type contents

5. Press Send button

6. System looks up email address in address book

7. System submits the email to the email server

Page 63: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

Starting the diagramStarting the diagram

• If this is an interactive scenario, we always have an actor driving it, so we put one on the sequence diagram

Page 64: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar

Add objectsAdd objects

The first interaction is with the icon bar, which we can treat as an object

Page 65: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar

Add messageAdd message

The user talks to the icon bar

Page 66: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Remember that actors can only communicate with interface objects such as screens, menus and icon bars.

: user

: icon bar

click send mail

Label the communicationLabel the communication

Page 67: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

It creates an email page.

Now the user can see the email page and use it.

: user

: icon bar : email page

click send mail create

The icon bar has some work to do. The icon bar has some work to do.

Page 68: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The next three steps are filling in the details on the email pageThe next three steps are filling in the details on the email page

: user

: icon bar : email page

click send mail create

fill in to box

fill in subject box

fill in contents box

Page 69: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar : email page

click send mail create

fill in to box

fill in subject box

fill in contents box

send

The user then clicks SendThe user then clicks Send

Page 70: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar : email page : address book

click send mail create

fill in to box

fill in subject box

fill in contents box

sendlook up email address

We can choose to get the email page to look up the email address from an address book object

Now consider how to do the sendingNow consider how to do the sending

Page 71: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar : email page : address book

click send mail create

fill in to box

fill in subject box

fill in contents box

sendlook up email address

So we don’t need to put a return arrow with the email address going back to the email page

The arrow allows information to The arrow allows information to returnreturn

Page 72: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: address book

: user

: icon bar : email page : email server

click send mail create

fill in to box

fill in subject box

fill in contents box

sendlook up email address

submit email

We can choose to get the email page to submit the email to the email server

Page 73: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar : email page : address book : email server

click send mail create

fill in to box

fill in subject box

fill in contents box

sendlook up email address

submit email

close

And if we think carefully, the email page always closes after the send.

Page 74: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: icon bar

: user

: email page : address book : email server

send mail( ) create

fill in to box

fill in subject box

fill in contents box

sendlook up email address

submit email

close

Now we go through and change the messages to operations on the object

Page 75: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

: user

: icon bar : email page : address book : email server

send mail( ) create( )

enterTo( )

enterSubject( )

enterContents( )

send( )getEmailAddress( )

submitEmail( )

close( )

And so on, all the way through

Page 76: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

icon bar

send mail()

email page

create()enterTo()enterSubject()enterContents()send()close()

address book

getEmailAddress()

email server

submitEmail()

And now we have found our objects, and the operations on them

So we drag them onto a class diagram

Page 77: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

The icon bar needs to communicate with the email page

icon bar

send mail()

email server

submitEmail()

email page

create()enterTo()enterSubject()enterContents()send()close()

address book

getEmailAddress()

We could use an arrowed relationship, but we generally don’t

Page 78: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

email server

submitEmail()

address book

getEmailAddress()

email page

create()enterTo()enterSubject()enterContents()send()close()

icon bar

send mail()

Likewise the email page communicates with the address bookand email server

Page 79: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

email server

submitEmail()

address book

getEmailAddress()

email page

create()enterTo()enterSubject()enterContents()send()close()

0..n

0..n

icon bar

send mail() 0..n

0..n

0..n0..n

Then we worry about multiplicity

Page 80: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Developing a Sequence DiagramDeveloping a Sequence Diagram

Work through a scenario step by step

Make actors communicate with screens, icons, menus

Make the screen actions (etc) trigger actions with objects

Convert the actions to operations

Page 81: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Class diagramsClass diagrams

Objects from the sequence diagram go on a class

diagram.

Operations are added automatically by the CASE tool

(e.g. Together)

Examine the sequence diagram to see where the

communication takes place.

Add relationships, and consider multiplicity.

Page 82: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Sequence Diagrams – why bother?Sequence Diagrams – why bother?

• Tie use cases and object models together

• Use the sequences in use cases

• Identify objects

• Identify relationships

• Identify operations

Page 83: Introduction to Sequence Diagrams. The Vision SSM Models Use Cases Activity Models Dynamic Models Object Models Programs Databases Business Computing.

Beginnings of a MethodBeginnings of a Method

Soft Systems

Model