Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 6C.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.

Similar presentations


Presentation on theme: "Slide 6C.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with."— Presentation transcript:

1 Slide 6C.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. 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

2 Slide 6C.2 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 6 — Unit C THE ANALYSIS WORKFLOW I

3 Slide 6C.3 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Continued from Unit 6B

4 Slide 6C.4 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.5 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.6 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.7 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.8 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.9 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.10 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.11 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.12 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l Osbert will not approve the specification document unless he understands it l Accordingly, a written description of the collaboration diagram is needed –The flow of events

13 Slide 6C.13 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l The flow of events of the collaboration diagram of the realization of the scenario of the use case

14 Slide 6C.14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l UML supports two different types of interaction diagram –Collaboration diagram –Sequence diagram l Both contain exactly the same information, but displayed in different ways

15 Slide 6C.15 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l Sequence diagram equivalent to the collaboration diagram (of the realization of the scenario of the use case)

16 Slide 6C.16 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l The vertical lines are called lifelines –The narrow rectangle on a lifeline shows when the relevant object is active l 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 Slide 6C.17 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 Slide 6C.18 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) 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

19 Slide 6C.19 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Interaction Diagrams l Information system developers can choose whether to use –A sequence diagram, or –A collaboration diagram, or –Both for each scenario

20 Slide 6C.20 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Interaction Diagrams l 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 l 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 Slide 6C.21 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterpiece Use Case (contd) l 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 l 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 Slide 6C.22 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l 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 Slide 6C.23 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l 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 Slide 6C.24 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l Class diagram showing the classes that realize the Buy a Masterwork use case

25 Slide 6C.25 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l One possible scenario of the use case

26 Slide 6C.26 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l The collaboration diagram of the scenario of the use case

27 Slide 6C.27 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l 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 Slide 6C.28 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l The flow of events of the collaboration diagram of the realization of the scenario of the use case

29 Slide 6C.29 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy a Masterwork Use Case (contd) l Sequence diagram equivalent to the collaboration diagram (of the realization of the scenario of the use case)

30 Slide 6C.30 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy Other Painting Use Case l Class diagram

31 Slide 6C.31 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Buy Other Painting Use Case (contd) l 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 Slide 6C.32 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Modifying the Main Menu l 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 l The revised screen is generated by : User Interface Class

33 Slide 6C.33 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. l The corresponding textual interface is: Modifying the Main Menu (contd)

34 Slide 6C.34 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. l Class diagram –The realization is straightforward Sell a Painting Use Case (contd)

35 Slide 6C.35 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Continued in Unit 6D


Download ppt "Slide 6C.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with."

Similar presentations


Ads by Google