Use Cases and Object Interaction - PowerPoint PPT Presentation

About This Presentation
Title:

Use Cases and Object Interaction

Description:

Depicts all use cases for a system. Interaction Diagram ... Stick Figures Actors. Could be a human user or a subsystem. Ellipses - Use Cases ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 15
Provided by: johnpaul3
Category:

less

Transcript and Presenter's Notes

Title: Use Cases and Object Interaction


1
Use Cases andObject Interaction
  • CS 123/CS 231

2
Depicting System Behavior
  • First, identify the use cases
  • Use case typical interaction between a user and
    the system
  • Use Case Diagram
  • Depicts all use cases for a system
  • Interaction Diagram
  • Depicts a single use case as a collection of
    interacting objects

3
ExampleUse Case Diagram
LIBRARY SYSTEM
Facilitate Checkout
Search for Book
Borrower
Librarian
Facilitate Return
4
Use Case Diagram Notation
  • Stick Figures Actors
  • Could be a human user or a subsystem
  • Ellipses - Use Cases
  • Links - between actors and use cases
  • Links between use cases
  • ltltusesgtgt to depict inclusion of a use case
  • ltltextendsgtgt to depict variations of a general
    use case

5
Example ltltusesgtgt
Facilitate Checkout
ltltusesgtgt
Log-in
Librarian
ltltusesgtgt
Facilitate Return
Note UML v.1.3 uses ltltincludesgtgt instead of
ltltusesgtgt
6
Example ltltextendsgtgt
By Author
ltltextendsgtgt
Search for Book query
Borrower
ltltextendsgtgt
By Subject
Note query is called an extension point
7
Describing a Use Case
  • Narrative
  • Library example (Facilitate Checkout) Given a
    borrowers ID Card and the book to be borrowed,
    the librarian enters the borrowers ID number and
    the books catalogue number. If the borrower is
    allowed to check out the book, the system
    displays that the book has been recorded as
    borrowed
  • Or, an Interaction Diagram

8
ExampleInteraction Diagram
2 checkIfAvailable()
Checkout Screen
Book
1 checkIfDelinquent() 3 borrowBook()
4 setBorrower()
Borrower
9
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)

10
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)

11
Including Conditionsand Types
2 avail checkIfAvailable()boolean
Checkout Screen
bBook
1 delinq checkIfDelinquent()boolean 3!delinq
avail borrowBook(Book b)
rBorrower
12
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
13
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
14
Summary
  • Provide a Use Case Diagram to depict the use
    cases of a system
  • For each use case, describe and provide an
    Interaction Diagram
  • Depict use case as a collection of interacting
    objects
  • Other diagramming techniques that aid in building
    a dynamic model
  • State diagram describes object state changes
  • Activity diagram describes method behavior
Write a Comment
User Comments (0)
About PowerShow.com