Interaction Diagrams - PowerPoint PPT Presentation

About This Presentation
Title:

Interaction Diagrams

Description:

Interaction Diagrams CS 124 Object collaboration A use case carried out involves objects and interaction or collaboration between these objects Method calls between ... – PowerPoint PPT presentation

Number of Views:170
Avg rating:3.0/5.0
Slides: 11
Provided by: ate119
Category:

less

Transcript and Presenter's Notes

Title: Interaction Diagrams


1
Interaction Diagrams
  • CS 124

2
Object collaboration
  • A use case carried out involves objects and
    interaction or collaboration between these
    objects
  • Method calls between objects
  • This collaboration is depicted in the UML through
    an Interaction Diagram
  • Two types
  • Collaboration diagram
  • Sequence diagram

3
ExampleCollaboration Diagram
2 checkIfAvailable()
Checkout Screen
Book
1 checkIfDelinquent() 3 borrowBook()
4 setBorrower()
Borrower
4
Interaction (Collaboration) Diagram Notation
  • Rectangles Classes/Objects
  • Arrows Messages/Method Calls
  • Labels on Arrows
  • sequence number (whole numbers or X.X.X notation)
  • method name (the message passed)
  • more details, if helpful and necessary
    (iterators, conditions, parameters, types, return
    types)

5
Methods
  • Interaction Diagrams suggest/imply methods for
    classes
  • Has consequences on detailed class diagram
  • The label(s) of an arrow should be a method of
    the class the arrow points to
  • Library System
  • Borrower class should have at least two methods
    (checkIfDelinquent and borrowBook)

6
Including Conditionsand Types
2 avail checkIfAvailable()boolean
Checkout Screen
bBook
1 delinq checkIfDelinquent()boolean 3!delinq
avail borrowBook(Book b)
rBorrower
7
Creating an Object
  • new means a constructor is being called
  • Implies object creation

1 addCustomer(custdetails)
CustomerList
Encoder
2 new
Note this means theaddCustomer method
willcontain code that createsa Customer object
Customer
8
Iteration
  • is an iterator
  • means the method is called repeatedly

1 printSalesSummary()
Store
Manager
2 getTotalSales()
Note Store needs data from all branches to
produce a summary
Branch
9
Sequence Diagram
  • Variant of an interaction diagram that emphasizes
    sequence
  • Objects shown as boxes on top of the diagram
  • Dashed vertical line below the box objects
    lifeline
  • Activation bar to indicate the objects
    activation
  • Sequence number unnecessary because top to bottom
    calling sequence is assumed
  • Message notation the same as for collaboration
    diagrams

10
Collaboration versus Sequence Diagrams
  • Use collaboration diagrams when you want to make
    use of a two-dimensional layout of interacting
    objects
  • Ok when there arent that many objects
  • Use sequence diagrams when layout doesnt help in
    presentation and when you want to clarify calling
    sequence
Write a Comment
User Comments (0)
About PowerShow.com