1 / 35

CHAPTER 6 — Unit C

An Introduction to Object-Oriented Systems Analysis and Design with UML and the Unified Process McGraw-Hill, 2004 Stephen R. Schach srs@vuse.vanderbilt.edu. CHAPTER 6 — Unit C. THE ANALYSIS WORKFLOW I. Continued from Unit 6B. Buy a Masterpiece Use Case (contd). Item 1:

lavi
Télécharger la présentation

CHAPTER 6 — Unit C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction toObject-Oriented Systems Analysis and Design with UML and the Unified ProcessMcGraw-Hill, 2004Stephen R. Schachsrs@vuse.vanderbilt.edu

  2. CHAPTER 6 — Unit C THE ANALYSIS WORKFLOW I

  3. Continued from Unit 6B

  4. Buy a Masterpiece Use Case (contd) • Item 1: • In paragraph 1 of this scenario, Osbert inputs the details of the masterpiece he is considering buying • In the collaboration diagram, this is modeled by message • 1: Give masterpiece details • from Osbert to the object : User Interface Class

  5. Buy a Masterpiece Use Case (contd) • Item 2: • In paragraphs 2 and 3 of the scenario, the maximum purchase price is computed by comparing the masterpiece under consideration with masterpieces that have previously been auctioned • This computation is performed by an instance of the control class, namely, object : Compute Masterpiece Price Class • To do this, details of the masterpiece under consideration need to be transferred from object : User Interface Class to object : Compute Masterpiece Price Class • This is modeled by message • 2: Transfer masterpiece details

  6. Buy a Masterpiece Use Case (contd) • Item 3: • To do the comparison, object : Compute Masterpiece Price Class has to create a masterpiece object • It first creates an instance of Masterpiece Class • This is modeled by message • 3: Create new object from : Compute Masterpiece Price Class to : Masterpiece Class • The [new] inside the object indicates that it is created as a consequence of the message • The new object is passed back to : Compute Masterpiece Price Class, modeled by message • 4: Return new object

  7. Buy a Masterpiece Use Case (contd) • Item 4: • : Compute Masterpiece Price Class compares the masterpiece under consideration with each of the previously auctioned masterpieces • It browses through all the instances of Auctioned Painting Class • This is modeled by message • 5: Browse auctioned paintings from : Compute Masterpiece Price Class to : Auctioned Painting Class and by message • 6: Return auctioned painting in the reverse direction

  8. Buy a Masterpiece Use Case (contd) • Item 5: • Having found the best match, : Compute Masterpiece Price Class computes the maximum price to be offered and informs Osbert what that price is • The price is transferred from : Compute Masterpiece Price Class to the user interface object : User Interface Class so that the price can be displayed • This is modeled by message • 7: Provide price • Next the price is displayed for Osbert by the message • 8: Display price

  9. Buy a Masterpiece Use Case (contd) • Item 6: • Osbert makes an offer for the masterpiece • The comment below paragraph 3 of the scenario states that the offer is accepted • Osbert now enters details provided by the seller • This is modeled by message • 9: Give seller details from Osbert to object : User Interface Class • The note indicates that the data are provided by the seller to Osbert

  10. Buy a Masterpiece Use Case (contd) • Item 7: • The seller data are passed on to object : Compute Masterpiece Price Class • This is modeled by message • 10: Transfer seller details to update the details of the masterpiece object : Masterpiece Class • This is modeled by message • 11: Request update

  11. Buy a Masterpiece Use Case (contd) • Item 8: • : Masterpiece Class then sends an acknowledgment to : Compute Masterpiece Price Class • This is modeled by message • 12: Send acknowledgment • This acknowledgment is then passed on to the user interface object : User Interface Class • This is modeled by message • 13: Send acknowledgment • : User Interface Class now displays it for Osbert • This is modeled by message • 14: Display acknowledgment

  12. Buy a Masterpiece Use Case (contd) • Osbert will not approve the specification document unless he understands it • Accordingly, a written description of the collaboration diagram is needed • The flow of events

  13. Buy a Masterpiece Use Case (contd) • The flow of events of the collaboration diagram of the realization of the scenario of the use case

  14. Buy a Masterpiece Use Case (contd) • UML supports two different types of interaction diagram • Collaboration diagram • Sequence diagram • Both contain exactly the same information, but displayed in different ways

  15. Buy a Masterpiece Use Case (contd) • Sequence diagram equivalent to the collaboration diagram (of the realization of the scenario of the use case)

  16. Buy a Masterpiece Use Case (contd) • The vertical lines are called lifelines • The narrow rectangle on a lifeline shows when the relevant object is active • In the collaboration diagram, the [new] is inside the : Masterpiece Class object • In the sequence diagram, the object is shifted down so that its lifeline starts where the object is created

  17. Buy a Masterpiece Use Case (contd) • The sequence diagram shows that every message of the scenario involves either • The instance of the user interface class : User Interface Class or • The instance of the control class : Compute Masterpiece Price Class

  18. Buy a Masterpiece Use Case (contd) • It also shows that every transfer of information from object A to object B is eventually followed by a transfer in the reverse direction • These two facts are also true in the fully equivalent collaboration diagram but are not as obvious in that format

  19. Interaction Diagrams • Information system developers can choose whether to use • A sequence diagram, or • A collaboration diagram, or • Both for each scenario

  20. Interaction Diagrams • The strength of a sequence diagram is that it shows the flow of messages and their order unambiguously • When transfer of information is the focus of attention, a sequence diagram is superior to a collaboration diagram • A collaboration diagram is similar to a class diagram • When the systems analysts are concentrating on the classes, a collaboration diagram is more useful than the equivalent sequence diagram

  21. Buy a Masterpiece Use Case (contd) • The seven previous figures depict different aspects of the use case Buy a Masterpiece • They use different notations and provide different levels of detail of the same activity • Why do we construct so many related artifacts? • We examine this one activity from a variety of different perspectives to learn enough about it to ensure that the analysis workflow will be correct

  22. Buy a Masterwork Use Case (contd) • The maximum price of a masterwork is computed by first treating the painting as if it were a masterpiece, and then adjusting the result

  23. Buy a Masterwork Use Case (contd) • The classes that enter into this use case are then: • User Interface Class • This class models the user interface • Compute Masterwork Price Class • This class models the computation of the price Osbert should offer • It creates a masterwork object and passes it to Compute Masterpiece Price Class as if it were a masterpiece • Compute Masterpiece Price Class • Masterpiece Class • The computation involves comparing the “masterpiece” being considered with the masterpieces that have been previously auctioned • Auctioned Painting Class • These masterpieces are instances of Auctioned Painting Class

  24. Buy a Masterwork Use Case (contd) • Class diagram showing the classes that realize the Buy a Masterwork use case

  25. Buy a Masterwork Use Case (contd) • One possible scenario of the use case

  26. Buy a Masterwork Use Case (contd) • The collaboration diagram of the scenario of the use case

  27. Buy a Masterwork Use Case (contd) • The main difference between this collaboration diagram and the one for Buy a Masterpiece is: • Object : Compute Masterwork Price Class creates a masterwork object (3: Create new object) and passes it to : Compute Masterpiece Price Class (5: Transfer masterwork) to compute the maximum asking price as if the painting were a masterpiece • This price is passed back to : Compute Masterwork Price Class (8: Provide price), which adjusts the price to reflect the fact that the painting in question is indeed a masterwork and not a masterpiece (9: Adjust price)  

  28. Buy a Masterwork Use Case (contd) • The flow of events of the collaboration diagram of the realization of the scenario of the use case

  29. Buy a Masterwork Use Case (contd) • Sequence diagram equivalent to the collaboration diagram (of the realization of the scenario of the use case)

  30. Buy Other Painting Use Case • Class diagram

  31. Buy Other Painting Use Case (contd) • Scenarios and interaction diagrams (collaboration diagram, sequence diagram), and associated flows of events are left as an exercise (Problems 6.11 through 6.14)

  32. Modifying the Main Menu • The main menu has to be modified to reflect buying the three different types of painting explicitly • Buy a painting must replaced by Buy a masterpiece, Buy a masterwork, and Buy other painting • The revised screen is generated by : User Interface Class

  33. Modifying the Main Menu (contd) • The corresponding textual interface is:

  34. Sell a Painting Use Case (contd) • Class diagram • The realization is straightforward

  35. Continued in Unit 6D

More Related