83ce801ec199b0e2db7e95a12c50cb3d.ppt
- Количество слайдов: 33
Slide 12 D. 88 Object-Oriented and Classical Software Engineering Sixth Edition, WCB/Mc. Graw-Hill, 2005 Stephen R. Schach srs@vuse. vanderbilt. edu © The Mc. Graw-Hill Companies, 2005
CHAPTER 12 — Unit D OBJECT-ORIENTED ANALYSIS © The Mc. Graw-Hill Companies, 2005 Slide 12 D. 89
Slide 12 D. 90 Continued from Unit 12 C © The Mc. Graw-Hill Companies, 2005
12. 13 Extracting the Control Classes: The Osbert Oglesby Case Study Slide 12 D. 91 l It is also usually easy to extract control classes 4 Each nontrivial computation is generally modeled by a control class l In the case study there are four computations 4 Determining the maximum price that Osbert should offer for a » Masterpiece » Masterwork, or » Other painting 4 Determining if there is a new trend in art purchases © The Mc. Graw-Hill Companies, 2005
Initial Control Classes: Osbert Oglesby (contd) Slide 12 D. 92 l There are therefore four initial control classes Figure 12. 28 © The Mc. Graw-Hill Companies, 2005
12. 14 Refining the Use Cases: The Osbert Oglesby Case Study Slide 12 D. 93 l The pricing algorithm treats the three types of paintings differently l Use case Buy a Painting must therefore be refined into three separate use cases 4 Buy a Masterpiece 4 Buy a Masterwork 4 Buy Other Painting © The Mc. Graw-Hill Companies, 2005
Refining the Use Cases: Osbert Oglesby (contd) Slide 12 D. 94 l Use case Produce a Report also needs to be refined 4 The purchases report and the sales report use simple data extraction — the future trends report involves computation 4 All three reports use their own boundary classes l For both these reasons, the Produce a Report use case must be refined into three use cases 4 Produce a Purchases Report 4 Produce a Sales Report 4 Produce a Future Trends Report © The Mc. Graw-Hill Companies, 2005
Third Iteration of the Use-Case Diagram Slide 12 D. 95 Figure 12. 29 © The Mc. Graw-Hill Companies, 2005
Refining the Use Cases: Osbert Oglesby (contd) Slide 12 D. 96 l Implications for the remaining UML diagrams include: 4 The description of the new Buy a Painting use case (see over) must be split into three separate descriptions 4 The description of the Produce a Report use case must be split into three separate descriptions © The Mc. Graw-Hill Companies, 2005
Use Case Buy a Masterpiece Slide 12 D. 97 Figure 12. 30 © The Mc. Graw-Hill Companies, 2005
Description of Use Case Buy a Masterpiece Slide 12 D. 98 Figure 12. 31 © The Mc. Graw-Hill Companies, 2005
Class Extraction (contd) Slide 12 D. 99 l The description of class extraction is complete l We now therefore return to the Unified Process © The Mc. Graw-Hill Companies, 2005
12. 15 Use-Case Realization: The Osbert Oglesby Case Study Slide 12 D. 100 l The process of extending and refining use cases is called use-case realization © The Mc. Graw-Hill Companies, 2005
Use-Case Realization (contd) l Slide 12 D. 101 The verb “realize” is used at least 3 different ways: 4 Understand (“Harvey slowly began to realize that he was in the wrong classroom”); 4 Receive (“Ingrid will realize a profit of $45, 000 on the stock transaction”); and 4 Accomplish (“Janet hopes to realize her dream of starting a computer company”) l In the phrase “realize a use case, ” the word “realize” is used in this last sense © The Mc. Graw-Hill Companies, 2005
Use-Case Realization (contd) l Slide 12 D. 102 The realization of a specific scenario of a use case is depicted using an interaction diagram 4 Either a sequence diagram or collaboration diagram l Consider use case Buy a Masterpiece l We have previously seen 4 The use case 4 The description of the use case © The Mc. Graw-Hill Companies, 2005
12. 15. 1 Buy a Masterpiece Use Case Slide 12 D. 103 l Class diagram (classes that enter into the use case) Figure 12. 32 © The Mc. Graw-Hill Companies, 2005
The Four Classes That Enter into This Use Case Slide 12 D. 104 l User Interface Class 4 This class models the user interface l Compute Masterpiece Price Class 4 This class models the computation of the price Osbert should offer l Masterpiece Class 4 The computation involves comparing the masterpiece being considered with the masterpieces that have been previously auctioned l Auctioned Painting Class 4 These masterpieces are all instances of Auctioned Painting Class © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 105 l The Seller does not interact directly with the software product 4 Instead, the Seller provides data that Osbert enters into the software product l This is indicated in the note (the rectangle with the top right-hand corner turned over) 4 There is a dashed line from the note to the item to which it refers, the Seller in this case © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 106 l Scenario (one possible instance of the use case) Figure 12. 33 © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 107 l An executing software product uses objects, not classes l Example: 4 A specific masterpiece is not represented by Masterpiece Class but rather by an object, a specific instance of Masterpiece Class l Such an object is denoted in UML by : Masterpiece Class © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 108 l A class diagram shows the classes in the use case and their relationships 4 It does not show the objects nor the sequence of messages as they are sent from object to object l Something more is needed © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 109 l A collaboration diagram (of the realization of the scenario of the use case) © The Mc. Graw-Hill Companies, 2005 Figure 12. 34
Buy a Masterpiece Use Case (contd) Slide 12 D. 110 l Osbert will not approve the specification document unless he understands it l Accordingly, a written description of the collaboration diagram is needed 4 The flow of events © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 111 l The flow of events of the collaboration diagram of the realization of the scenario of the use case Figure 12. 35 © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 112 l UML supports two different types of interaction diagram 4 Collaboration diagram 4 Sequence diagram l Both contain exactly the same information, but displayed in different ways © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 113 l Sequence diagram equivalent to the collaboration diagram (of the realization of the scenario of the use case) © The Mc. Graw-Hill Companies, 2005 Figure 12. 36
Buy a Masterpiece Use Case (contd) Slide 12 D. 114 l The narrow rectangle on a lifeline (dashed vertical line) shows when the relevant object is active l In the collaboration diagram, the [new] is inside the : Masterpiece Class object 4 In the sequence diagram, the object is shifted down so that its lifeline starts where the object is created © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 115 l The sequence diagram shows that every message of the scenario involves either 4 The instance of the user interface class : User Interface Class or 4 The instance of the control class : Compute Masterpiece Price Class © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 116 l It also shows that every transfer of information from object A to object B is eventually followed by a transfer in the reverse direction l These two facts are also true in the fully equivalent collaboration diagram, but are not as obvious in that format © The Mc. Graw-Hill Companies, 2005
Interaction Diagrams l Slide 12 D. 117 Software engineers can choose whether to use 4 A sequence diagram, or 4 A collaboration diagram, or 4 Both for each scenario © The Mc. Graw-Hill Companies, 2005
Interaction Diagrams l Slide 12 D. 118 The strength of a sequence diagram is that it shows the flow of messages and their order unambiguously 4 When transfer of information is the focus of attention, a sequence diagram is superior to a collaboration diagram l A collaboration diagram is similar to a class diagram 4 When the developers are concentrating on the classes, a collaboration diagram is more useful than the equivalent sequence diagram © The Mc. Graw-Hill Companies, 2005
Buy a Masterpiece Use Case (contd) Slide 12 D. 119 l The seven previous figures depict different aspects of the use case Buy a Masterpiece 4 They use different notations and provide different levels of detail of the same activity l Why do we construct so many related artifacts? 4 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 © The Mc. Graw-Hill Companies, 2005
Slide 12 D. 120 Continued in Unit 12 E © The Mc. Graw-Hill Companies, 2005
83ce801ec199b0e2db7e95a12c50cb3d.ppt