Use case-diagrams

45,669 views

Published on

Use case diagrams

Use case-diagrams

  1. 1. Use Case Diagrams A Detailed Description
  2. 2. Use Case Diagrams <ul><li>Use case diagrams describe relationships between users and use cases </li></ul><ul><li>A use case is a (usually high-level) user activity in the system </li></ul><ul><ul><li>A use case is a collection of related success and failure scenarios that describe actors using a system to support a goal </li></ul></ul><ul><ul><li>A use case name should generally begin with a verb </li></ul></ul>
  3. 3. Use Case Diagrams <ul><li>Use case diagrams consist of at least two components: </li></ul><ul><ul><li>An actor </li></ul></ul><ul><ul><ul><li>Actors are represented as stick people, with a label below, naming the actor's role </li></ul></ul></ul><ul><ul><ul><li>There may be multiple actors in a diagram </li></ul></ul></ul><ul><ul><li>A use case </li></ul></ul><ul><ul><ul><li>Use cases are represented as ellipses, with a label inside, naming the use case </li></ul></ul></ul><ul><ul><ul><li>There may be multiple use cases in a diagram </li></ul></ul></ul>
  4. 4. Use Cases <ul><li>For an example, consider an auction website (e.g. eBay) </li></ul><ul><li>The actor customer might: </li></ul><ul><ul><li>Register for an account </li></ul></ul><ul><ul><li>Search for items by keyword </li></ul></ul><ul><ul><li>Place a bid on an item </li></ul></ul><ul><ul><li>Put an item up for auction </li></ul></ul><ul><ul><li>Check the status of this item </li></ul></ul>
  5. 5. Actors <ul><li>An actor represents a role that a user might play </li></ul><ul><ul><li>For example, a network administrator at a company might play the following roles: </li></ul></ul><ul><ul><ul><li>NetAdmin </li></ul></ul></ul><ul><ul><ul><li>Employee </li></ul></ul></ul><ul><ul><li>Each role must be represented separately </li></ul></ul>
  6. 6. Use Cases <ul><li>For the auction website example, a system administrator can act in two roles: </li></ul><ul><ul><li>Administrator </li></ul></ul><ul><ul><li>Customer </li></ul></ul>
  7. 7. Auction Website Use Cases Auction Website Search for item Place bid Put item up for auction Register account Customer
  8. 8. Use Case Diagrams <ul><li>Obviously, actor and use case names must be unique within a given diagram </li></ul><ul><li>Consider use cases to be similar to classes: </li></ul><ul><ul><li>A use case describes an activity that is possible </li></ul></ul><ul><ul><li>A given system may have several instances of that activity throughout its lifetime </li></ul></ul><ul><ul><li>A use case is a (coarse-grained/large) unit of behaviour, and a class is a unit of software </li></ul></ul>
  9. 9. A simple example <ul><li>Example: In an on-line Bookstore system, user needs to log-in first before he/she could order and purchase any desired books. Describe the use case for the log-in process of the on-line Bookstore system. </li></ul><ul><li>Answer: For every log-in process, there are two flows </li></ul><ul><ul><li>When the log-in is successful (main-flow) </li></ul></ul><ul><ul><li>When the log-in is not successful (alternate-flows) </li></ul></ul><ul><ul><li>For each flow, we can describe the sequence/flow of events. </li></ul></ul>
  10. 10. Customer Use Case Description: A CUSTOMER needs to log-in before performing any transaction Pre-condition: A registered user. Post-condition: The CUSTOMER has been authorised to perform transactions. Use Case: Log-in Log-in
  11. 11. Case Study: On-Line Bookstore
  12. 12. <ul><li>On-line Bookstore is a web application that can be accessed by the store’s registered customer, whereby each customer can order books, review one or more books sold in the book store, and sell used books to other customers. Before performing any one of these transactions, the customer must first log-in into the system using their user id and password kept in their account. </li></ul><ul><li>Problem : Draw the use-case diagram for the above system </li></ul>
  13. 13. <ul><li>The steps involved: - </li></ul><ul><ul><li>Identify the actor : CUSTOMER </li></ul></ul><ul><ul><li>Identify the use case for the actor: </li></ul></ul><ul><ul><ul><li>CUSTOMER </li></ul></ul></ul><ul><ul><ul><ul><li>REGISTER </li></ul></ul></ul></ul><ul><ul><ul><ul><li>LOG-IN </li></ul></ul></ul></ul><ul><ul><ul><ul><li>ORDER BOOKS </li></ul></ul></ul></ul><ul><ul><ul><ul><li>CHECK OUT </li></ul></ul></ul></ul><ul><ul><ul><ul><li>REVIEW BOOKS </li></ul></ul></ul></ul><ul><ul><ul><ul><li>SELL USED BOOKS </li></ul></ul></ul></ul><ul><ul><li>For each use case, determine include and extend relationships, if any </li></ul></ul><ul><ul><ul><li>A Customer must log-in first before he/she can order books, check out, review books or sell used books: include relationship </li></ul></ul></ul><ul><ul><ul><li>A Customer can proceed to check out after he/she has ordered books: extend relationship </li></ul></ul></ul>
  14. 14. Register Order books Sell used books Review books Customer On-line Bookstore System Log-in <<include>> <<include>> <<include>> Check out <<extend>> (CustID) Use Case Context Diagram
  15. 15. A CUSTOMER needs to log-in before performing any transaction Actor/s: CUSTOMER Pre-condition: A registered user. Main flow of events: 1. The CUSTOMER clicks the Log-in button on the Home Page. Log-in A new CUSTOMER needs to first register into the system before performing any transaction. Actor/s: CUSTOMER Pre-condition: An unregistered CUSTOMER. Main flow of events: 1. The CUSTOMER clicks the REGISTER button on the Home Page. 2. The system displays the Register Page. 3. The CUSTOMER enters all of the required information. 4. The CUSTOMER clicks the SEND button. 5. The system checks that all of the required information were entered. If yes, the system update the CUSTOMER’s record in the CUSTOMER and ACCOUNT tables in the database. System displays OK message. Post-condition: The new CUSTOMER has registered. The ACCOUNT and CUSTOMER tables are updated. Register Description Use Case
  16. 16. 2. The system displays the Log-in Page. 3. The CUSTOMER enters his/her user ID and password. 4. The CUSTOMER clicks the OK button. 5. The system validates the log-in information against the ACCOUNT table in the database. 6. CUSTOMER is an authorised user; the system displays the Personal Home Page to the CUSTOMER Post-condition: The CUSTOMER has been authorised to perform transactions. Alternate flow: 1. The CUSTOMER clicks the Log-in button on the Home Page. 2. The system displays the Log-in Page. 3. The CUSTOMER enters his/her user ID and password. 4. The CUSTOMER clicks the OK button. 5. The system validates the log-in information against the ACCOUNT table in the database. 6. CUSTOMER is not an authorised user; the system displays a pop-up message to inform the CUSTOMER. Post-condition: The CUSTOMER is not authorised to perform transactions. Log-in (continue…) Description Use Case
  17. 17. A CUSTOMER can purchase the books in his/her Shopping Cart. Actor/s: CUSTOMER Pre-condition: The user have logged in and has at least one book in the Shopping Cart. Main flow of events: 1. The CUSTOMER clicks the Check out button on the Web Page. Check Out A CUSTOMER can order books to purchase. Actor/s: CUSTOMER Pre-condition: User have logged-in. Main flow of events: 1. The CUSTOMER enters the keyword for a book and clicks the SEARCH button on the Personal Home Page. 2. The system displays the matching books on the web Page. 3. The CUSTOMER chooses the desired book and clicks the ADD TO SHOPPING CART button on the web page. 4. The system adds the book into the CUSTOMER’s Order table in the database. Post-condition: The ORDER table has been updated. Order Books Description Use Case
  18. 18. A CUSTOMER can sell his/her used books. Actor/s: CUSTOMER Pre-condition: The user have logged-in.. Sell used books 2. The system displays the books in the ORDER table of the CUSTOMER on the web Page. 3. The CUSTOMER checks the order list for any inconsistency. If nothing found, CUSTOMER clicks the PROCEED button. 4. The system displays the Invoice page. 5. The Customer enters the relevant credit card information and clicks the OK button. 6. The system checks that the credit card is valid. Then, the system displays the Delivery Details page. 7. The CUSTOMER chooses destination for delivery, along with delivery options. Then, he/she clicks the PROCEED button. 8. The system will display the check-out information for confirmation. 7. The CUSTOMER checks that all information is correct and then clicks the OK button. 8. The system sends a confirmation via CUSTOMER’s e-mail. Post-condition: The ORDER table has been updated. Check Out (continue…) Description Use Case
  19. 19. A CUSTOMER can review books. Actor/s: CUSTOMER Pre-condition: User have logged-in.. Main flow of events: 1. The CUSTOMER enters the keyword to search for a book and then clicks the SEARCH button on the Personal Web Page. Review Books Main flow of events: 1. The CUSTOMER clicks the Sell Used Books button on the Home Page. 2. The system displays the Sell used books web page. 3. The CUSTOMER enters the required information on the used books that he/she wants to sell. 4. The CUSTOMER clicks the SEND button on the webpage. 5. The system displays a confirmation page listing the information that the CUSTOMER has entered. 6. The CUSTOMER checks that the information displayed are accurate. If yes, the CUSTOMER clicks the OK button on the web page. 7. The system updates the USED BOOKS table in the database. Post-condition: The Used Books table has been updated. Sell Used Books (continue…) Description Use Case
  20. 20. 2. The system displays the matching books on the web Page. 3. The CUSTOMER checks for the desired book and clicks on the chosen book icon. 4. The system displays the book’s detail in the Book Detail web page. 5. The CUSTOMER clicks the REVIEW button on the web page. 6. The system displays the Review Book web page. 7. The CUSTOMER clicks on the desired star button and the click the OK button on the web page. 8. The system calculates the overall rating of the book and updates the Book table in the database. 9. The system displays the Book Detail web pages that have been updated. Post-condition: The BOOK and REVIEW tables are updated. Review Books (continue…) Description Use Case

×