Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen.

Similar presentations


Presentation on theme: "Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen."— Presentation transcript:

1 Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen R. Schach srs@vuse.vanderbilt.edu

2 Slide 11.2 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 11 THE ANALYSIS WORKFLOW

3 Slide 11.3 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview l The specification document l Informal specifications l Correctness proof mini case study redux l The analysis workflow l Extracting the entity classes l The elevator problem l Functional modeling: The elevator problem case study l Entity class modeling: The elevator problem case study

4 Slide 11.4 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview (contd) l Dynamic modeling: The elevator problem case study l The test workflow: The elevator problem case study l Extracting the boundary and control classes l The initial functional model: The MSG Foundation case study l The initial class diagram: The MSG Foundation case study

5 Slide 11.5 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview (contd) l The initial dynamic model: The MSG Foundation case study l Revising the entity classes: The MSG Foundation case study l Extracting the boundary classes: The MSG Foundation case study l Extracting the control classes: The MSG Foundation case study l Use-case realization: The MSG Foundation case study

6 Slide 11.6 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview (contd) l Incrementing the class diagram: The MSG Foundation case study l The software project management plan: The MSG Foundation case study l The test workflow: The MSG Foundation case study l The specification document in the Unified Process l More on actors and use cases l CASE tools for the analysis workflow l Challenges of the analysis workflow

7 Slide 11.7 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document Must Be l Informal enough for the client – The client is generally not a computer specialist l Formal enough for the developers – It is the sole source of information for drawing up the design l These two requirements are mutually contradictory

8 Slide 11.8 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.1 The Specification Document l The specification document is a contract between the client and the developers l Typical constraints – Deadline – Parallel running – Portability – Reliability – Rapid response time l For real-time software – Hard real-time constraints must be satisfied

9 Slide 11.9 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Specification Document (contd) l Acceptance criteria – It is vital to spell out a series of tests l If the product passes the tests, it is deemed have satisfied its specifications l Some acceptance criteria are restatements of constraints

10 Slide 11.10 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Solution Strategy l A general approach to building the product l Find strategies without worrying about constraints – Then modify the strategies in the light of the constraints, if necessary l Keep a written record of all discarded strategies, and why they were discarded – To protect the analysis team – To prevent unwise new “solutions” during postdelivery maintenance

11 Slide 11.11 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.2 Informal Specifications l Informal specifications are written in a natural language – Examples: English, Mandarin, Kiswahili, Hindi l Example “If the sales for the current month are below the target sales, then a report is to be printed, unless the difference between target sales and actual sales is less than half of the difference between target sales and actual sales in the previous month, or if the difference between target sales and actual sales for the current month is under 5%”

12 Slide 11.12 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Meaning of This Specification l The sales target for January was $100,000, but actual sales were only $64,000 (36% below target) – Print the report l The sales target for February was $120,000, the actual sales were only $100,000 (16.7% below target) – The percentage difference for February (16.7%) is less than half of the previous month’s percentage difference (36%), so do not print the report

13 Slide 11.13 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Meaning of This Specification (contd) l The sales target for March was $100,000, the actual sales were $98,000 (2% below target) – The percentage difference is under 5%, so do not print the report

14 Slide 11.14 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. But the Specifications Do Not Say This l “[D]ifference between target sales and actual sales” – There is no mention of percentage difference in the specifications l The difference in January was $36,000, the difference in February was $20,000 – Not less than half of $36,000, so the report is printed l “[D]ifference … [of] 5%” – Again, no mention of percentage

15 Slide 11.15 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. But the Specifications Do Not Say This (contd) l Ambiguity—should the last clause read “percentage difference … [of] 5%” or “difference … [of] $5,000” or something else entirely? l The style is poor – The specifications should state when the report should be printed … – … Rather than when it should not be printed

16 Slide 11.16 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Informal Specifications (contd) l Claim – This cannot arise with professional specifications writers l Refutation – Text processing case study

17 Slide 11.17 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.3 Correctness Proof Case Study l Naur text-processing problem Given a text consisting of words separated by blank or by newline characters, convert it to line-by-line form in accordance with the following rules: (1) Line breaks must be made only where the given text contains a blank or newline ; (2)Each line is filled as far as possible, as long as (3)No line will contain more than maxpos characters

18 Slide 11.18 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 1 l 1969 — Naur Paper l Naur constructed a procedure (25 lines of Algol 60), and informally proved its correctness

19 Slide 11.19 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 2 l 1970 — Reviewer in Computing Reviews – The first word of the first line is preceded by a blank unless the first word is exactly maxpos characters long

20 Slide 11.20 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 3 l 1971 — London found 3 more faults – Including: The procedure does not terminate unless a word longer than maxpos characters is encountered

21 Slide 11.21 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 4 l 1975 — Goodenough and Gerhart found 3 further faults – Including: The last word will not be output unless it is followed by a blank or newline l Goodenough and Gerhart then produced a new set of specifications, about four times longer than Naur’s

22 Slide 11.22 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 5 l 1985 — Meyer detected 12 faults in Goodenough and Gerhart’s specifications

23 Slide 11.23 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 5 l Goodenough and Gerhart’s specifications – Were constructed with the greatest of care – Were constructed to correct Naur’s specifications – Went through two versions, carefully refereed – Were written by experts in specifications, – With as much time as they needed, – For a product about 30 lines long l So, what chance do we have of writing fault-free specifications for a real product?

24 Slide 11.24 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Episode 6 l 1989 — Schach found a fault in Meyer’s specifications – Item (2) of Naur’s original requirement (“each line is filled as far as possible”) is not satisfied

25 Slide 11.25 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Informal Specifications (contd) l Conclusion – Natural language is not a good way to specify a product

26 Slide 11.26 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Analysis l OOA is a semiformal analysis technique for the object-oriented paradigm – There are over 60 equivalent techniques – Today, the Unified Process is the only viable alternative l During this workflow – The classes are extracted l Remark – The Unified Process assumes knowledge of class extraction

27 Slide 11.27 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.4 The Analysis Workflow l The analysis workflow has two aims – Obtain a deeper understanding of the requirements – Describe them in a way that will result in a maintainable design and implementation

28 Slide 11.28 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l There are three types of classes: l Entity classes l Boundary classes l Control classes

29 Slide 11.29 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l Entity class – Models long-lived information l Examples: – Account Class – Investment Class

30 Slide 11.30 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l Boundary class – Models the interaction between the product and the environment – A boundary class is generally associated with input or output l Examples: – Investments Report Class – Mortgages Report Class

31 Slide 11.31 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l Control class – Models complex computations and algorithms l Example: – Estimate Funds for Week Class

32 Slide 11.32 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. UML Notation for These Three Class Types l Stereotypes (extensions of UML) Figure 11.1

33 Slide 11.33 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.5 Extracting the Entity Classes l Perform the following three steps incrementally and iteratively – Functional modeling » Present scenarios of all the use cases (a scenario is an instance of a use case) – Class modeling » Determine the entity classes and their attributes » Determine the interrelationships and interactions between the entity classes » Present this information in the form of a class diagram – Dynamic modeling » Determine the operations performed by or to each entity class » Present this information in the form of a statechart

34 Slide 11.34 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.6 The Elevator Problem A product is to be installed to control n elevators in a building with m floors. The problem concerns the logic required to move elevators between floors according to the following constraints: 1.Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and cause the elevator to visit the corresponding floor. The illumination is canceled when the corresponding floor is visited by the elevator 2.Each floor, except the first and the top floor, has two buttons, one to request an up-elevator, one to request a down-elevator. These buttons illuminate when pressed. The illumination is canceled when an elevator visits the floor, then moves in the desired direction 3.If an elevator has no requests, it remains at its current floor with its doors closed

35 Slide 11.35 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.7 Functional Modeling: The Elevator Problem Case Study l A use case describes the interaction between – The product, and – The actors (external users)

36 Slide 11.36 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Cases l For the elevator problem, there are only two possible use cases – Press an Elevator Button, and – Press a Floor Button Figure 11.2

37 Slide 11.37 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Scenarios l A use case provides a generic description of the overall functionality l A scenario is an instance of a use case l Sufficient scenarios need to be studied to get a comprehensive insight into the target product being modeled

38 Slide 11.38 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Normal Scenario: Elevator Problem Figure 11.3

39 Slide 11.39 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Exception Scenario: Elevator Problem Figure 11.4

40 Slide 11.40 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8 Entity Class Modeling : The Elevator Problem Case Study l Extract classes and their attributes – Represent them using a UML diagram l One alternative: Deduce the classes from use cases and their scenarios – Possible danger: Often there are many scenarios, and hence – Too many candidate classes l Other alternatives: – CRC cards (if you have domain knowledge) – Noun extraction

41 Slide 11.41 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8.1 Noun Extraction l A two-stage process l Stage 1. Concise problem definition – Describe the software product in single paragraph – Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator to stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed

42 Slide 11.42 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction (contd) l Stage 2. Identify the nouns – Identify the nouns in the informal strategy – Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator to stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed l Use the nouns as candidate classes

43 Slide 11.43 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction (contd) l Nouns – button, elevator, floor, movement, building, illumination, request, door – floor, building, door are outside the problem boundary — exclude – movement, illumination, request are abstract nouns — exclude (they may become attributes) l Candidate classes: – Elevator Class and Button Class l Subclasses: – Elevator Button Class and Floor Button Class

44 Slide 11.44 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. First Iteration of Class Diagram l Problem – Buttons do not communicate directly with elevators – We need an additional class: Elevator Controller Class Figure 11.5

45 Slide 11.45 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Class Diagram l All relationships are now 1-to-n – This makes design and implementation easier Figure 11.6

46 Slide 11.46 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8.2 CRC Cards l Used since 1989 for OOA l For each class, fill in a card showing – Name of Class – Functionality (Responsibility) – List of classes it invokes (Communication) l Now CRC cards are automated (CASE tool component)

47 Slide 11.47 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Strength – When acted out by team members, CRC cards are a powerful tool for highlighting missing or incorrect items l Weakness – If CRC cards are used to identify entity classes, domain expertise is needed

48 Slide 11.48 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.9 Dynamic Modeling: The Elevator Problem Case Study l Produce a UML statechart l State, event, and predicate are distributed over the statechart Figure 11.7

49 Slide 11.49 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Modeling: Elevator Problem (contd) l This UML statechart is equivalent to the state transition diagram of Figures 11.15 through 11.17 l This is shown by considering specific scenarios l In fact, a statechart is constructed by modeling the events of the scenarios

50 Slide 11.50 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.10 The Test Workflow: Elevator Problem l CRC cards are an excellent testing technique Figure 11.8

51 Slide 11.51 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards l Consider responsibility – 1.Turn on elevator button l This is totally inappropriate for the object-oriented paradigm – Responsibility-driven design has been ignored – Information hiding has been ignored l Responsibility 1.Turn on elevator button should be 1.Send message to Elevator Button Class to turn itself on

52 Slide 11.52 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Also, a class has been overlooked l The elevator doors have a state that changes during execution (class characteristic) – Add class Elevator Doors Class – Safety considerations l Modify the CRC card

53 Slide 11.53 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the CRC Card Figure 11.9

54 Slide 11.54 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Having modified the class diagram, reconsider the – Use-case diagram (no change) – Class diagram (see the next slide) – Statecharts – Scenarios (see the slide after the next slide)

55 Slide 11.55 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of Class Diagram Figure 11.10

56 Slide 11.56 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the Normal Scenario: Figure 11.11

57 Slide 11.57 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow: Elevator Problem (contd) l The analysis workflow is now fine l We should rather say: – The analysis workflow is fine for now l We may need to return to the analysis workflow during the design workflow

58 Slide 11.58 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.11 Extracting the Boundary and Control Classes l Each – Input screen, – Output screen, and – Report is modeled by its own boundary class l Each nontrivial computation is modeled by a control class

59 Slide 11.59 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.12 The Initial Functional Model: MSG Foundation ●Recall the seventh iteration of the use-case diagram Figure 11.12

60 Slide 11.60 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case Manage a Mortgage l One possible extended scenario Figure 11.13

61 Slide 11.61 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case Manage a Mortgage (contd) l A second extended scenario Figure 11.14

62 Slide 11.62 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case Estimate Funds Available for Week l One possible scenario Figure 11.15

63 Slide 11.63 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case Produce a Report l One possible scenario Figure 11.16

64 Slide 11.64 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case Produce a Report (contd) l Another possible scenario Figure 11.17

65 Slide 11.65 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.13 The Initial Class Diagram: MSG Foundation l The aim of entity modeling step is to extract the entity classes, determine their interrelationships, and find their attributes l Usually, the best way to begin this step is to use the two-stage noun extraction method

66 Slide 11.66 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation l Stage 1: Describe the software product in a single paragraph – Weekly reports are to be printed showing how much money is available for mortgages. In addition, lists of investments and mortgages must be printed on demand.

67 Slide 11.67 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation (contd) l Stage 2: Identify the nouns in this paragraph – Weekly reports are to be printed showing how much money is available for mortgages. In addition, lists of investments and mortgages must be printed on demand. l The nouns are report, money, mortgage, list, and investment

68 Slide 11.68 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation (contd) l Nouns report and list are not long lived, so they are unlikely to be entity classes ( report will surely turn out to be a boundary class) l money is an abstract noun l This leaves two candidate entity classes – Mortgage Class and Investment Class

69 Slide 11.69 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. First Iteration of the Initial Class Diagram Figure 11.18

70 Slide 11.70 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the Initial Class Diagram l Operations performed on the two entity classes are likely to be very similar – Insertions, deletions, and modifications – All members of both entity classes have to be printed on demand Mortgage Class and Investment Class should be subclasses of a superclass called Asset Class

71 Slide 11.71 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Initial Class Diagram (contd) Figure 11.19

72 Slide 11.72 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Back to the Requirements Workflow The current five use cases include Manage a Mortgage and Manage an Investment These two can now be combined into a single use case, Manage an Asset

73 Slide 11.73 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Eighth Iteration of the Use-Case Diagram l The new use case is shaded Figure 11.20

74 Slide 11.74 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Class Diagram: MSG Foundation (contd) l Finally, we add the attributes of each class to the class diagram – For the MSG Foundation case study, the result is shown on the next slide l The empty rectangle at the bottom of each box will later be filled with the operations of that class

75 Slide 11.75 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Initial Class Diagram (contd) Figure 11.21

76 Slide 11.76 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Iteration and Incrementation l The phrase “iterate and increment” also includes the possibility of having to decrement what has been developed to date – A mistake may have been made, and backtracking is needed – As a consequence of reorganizing the UML models, one or more artifacts may have become superfluous

77 Slide 11.77 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.14 The Initial Dynamic Model: MSG Foundation l Dynamic modeling is the third step in extracting the entity classes l A statechart is constructed that reflects all the operations performed by or to the software product l The operations are determined from the scenarios

78 Slide 11.78 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) Figure 11.22

79 Slide 11.79 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) l The statechart reflects the operations of the complete MSG Foundation information system – The solid circle on the top left represents the initial state, the starting point of the statechart – The white circle containing the small black circle on the top right represents the final state – States other than the initial and final states are represented by rectangles with rounded corners – The arrows represent possible transitions from state to state

80 Slide 11.80 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) l In state MSG Foundation Information System Loop, one of five events can occur l An MSG staff member can issue one of five commands: – estimate funds for the week – manage an asset – update estimated annual operating expenses – produce a report, or – quit

81 Slide 11.81 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) l These possibilities are indicated by the five events – estimate funds for the week selected – manage an asset selected – update estimated annual operating expenses selected – produce a report selected, and – quit selected l An event causes a transition between states

82 Slide 11.82 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) l An MSG staff member selects an option by clicking on the menu l This graphical user interface (GUI) requires special software Figure 11.23

83 Slide 11.83 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation (contd) l Equivalent textual user interface that can run on any computer Figure 11.24

84 Slide 11.84 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.15 Revising the Entity Classes: MSG Foundation l The initial functional model, the initial class diagram, and the initial dynamic model are completed – Checking them reveals a fault l In the initial statechart, consider state Update Estimated Annual Operating Expenses with operation Update the estimated annual operating expenses – This operation has to be performed on the current value of the estimated annual operating expense

85 Slide 11.85 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Revising the Entity Classes: MSG Foundation (contd) l But where is the value of the estimated annual operating expenses to be found? l Currently there is only one class ( Asset Class ) and its two subclasses – Neither is appropriate for storing the estimated annual operating expenses

86 Slide 11.86 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Revising the Entity Classes: MSG Foundation (contd) l The only way a value can be stored on a long-term basis is as an attribute of an instance of that class or its subclasses l Another entity class is needed for storing the estimated annual operating expenses – MSG Application Class

87 Slide 11.87 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of the Initial Class Diagram: MSG Foundation l MSG l Application Class has other attributes as well – Attributes that do not appertain to the assets Figure 11.25

88 Slide 11.88 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of the Initial Class Diagram: MSG Foundation Figure 11.26 l The class diagram redrawn to show the prototypes

89 Slide 11.89 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.16 Extracting the Boundary Classes: MSG Foundation l It is usually easy to extract boundary classes – Each input screen, output screen, and printed report is generally modeled by a boundary class l One screen should be adequate for all four MSG Foundation use cases » Estimate Funds Available for Week » Manage an Asset » Update Estimated Annual Operating Expenses » Produce a Report l Accordingly there is one initial boundary class – User Interface Class

90 Slide 11.90 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Extracting Boundary Classes: MSG Foundation (contd) l Three reports have to be printed – The estimated funds for the week report – The listing of all mortgages – The listing of all investments l Each of these has to be modeled by a separate boundary class – Estimated Funds Report Class – Mortgages Report Class – Investments Report Class

91 Slide 11.91 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Extracting Boundary Classes: MSG (contd) l Here are the four initial boundary classes Figure 11.27

92 Slide 11.92 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Boundary Classes: MSG Foundation (contd) l There are three reports: – The purchases report – The sales report – The future trends report l The content of each report is different – Each report therefore has to be modeled by a separate boundary class

93 Slide 11.93 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.17 Extracting the Control Classes: MSG Foundation l Each computation is usually modeled by a control class l The MSG Foundation case study has just one – Estimate the funds available for the week l There is one initial control class Figure 11.28

94 Slide 11.94 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. l The description of class extraction is complete l We now therefore return to the Unified Process Class Extraction (contd)

95 Slide 11.95 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18 Use-Case Realization: The MSG Foundation Case Study l The process of extending and refining use cases is called use-case realization

96 Slide 11.96 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use-Case Realization (contd) l The verb “realize” is used at least 3 different ways: – Understand (“Harvey slowly began to realize that he was in the wrong classroom”); – Receive (“Ingrid will realize a profit of $45,000 on the stock transaction”); and – 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

97 Slide 11.97 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use-Case Realization (contd) l The realization of a specific scenario of a use case is depicted using an interaction diagram – Either a sequence diagram or communication diagram Consider use case Estimate Funds Available for Week l We have previously seen – The use case – The description of the use case

98 Slide 11.98 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18.1 Estimate Funds Available for Week Use Case l Use case Figure 11.29

99 Slide 11.99 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Description of use case Figure 11.30

100 Slide 11.100 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Class diagram (classes that enter into the use case) Figure 11.31

101 Slide 11.101 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l The six classes that enter into this use case are: – User Interface Class » This class models the user interface – Estimate Funds for Week Class » This control class models the computation of the estimate of the funds that are available to fund mortgages during that week – Mortgage Class » This class models the estimated grants and payments for the week – Investment Class » This class models the estimated return on investments for the week – MSG Application Class » This class models the estimated operating expenses for the week – Estimated Funds Report Class » This class models the printing of the report

102 Slide 11.102 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Scenario (one possible instance of the use case) Figure 11.32

103 Slide 11.103 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l A working information system uses objects, not classes – Example: A specific mortgage cannot be represented by Mortgage Class but rather by an object, a specific instance of Mortgage Class Such an object is denoted by : Mortgage Class

104 Slide 11.104 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l A class diagram shows the classes in the use case and their relationships – It does not show the objects nor the sequence of messages as they are sent from object to object l Something more is needed

105 Slide 11.105 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Communication diagram (of the realization of the scenario of the use case) Figure 11.33

106 Slide 11.106 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l The communication diagram shows the objects as well as the messages, numbered in the order in which they are sent in the specific scenario

107 Slide 11.107 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 1: – The staff member wants to compute the funds available for the week – In the communication diagram, this is modeled by message » 1: Request estimate of funds available for week from MSG Staff Member to : User Interface Class, an instance of User Interface Class

108 Slide 11.108 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 2 – This request is passed on to : Estimate Funds for Week Class, an instance of the control class that actually performs the calculation – This is modeled by message » 2: Transfer request Four separate financial estimates are now determined by : Estimate Funds for Week Class

109 Slide 11.109 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 3 – In Step 1 of the scenario, the estimated annual return on investments is summed for each investment and the result divided by 52 – This extraction of the estimated weekly return is modeled by message » 3: Request estimated return on investments for week from : Estimate Funds for Week Class to : Investment Class followed by message » 4: Return estimated weekly return on investments in the other direction

110 Slide 11.110 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 4 – In Step 2 of the scenario, the weekly operating expenses are estimated by taking the estimated annual operating expenses and dividing by 52 – This extraction of the weekly expenses is modeled by message » 5: Request estimated operating expenses for week from : Estimate Funds for Week Class to : MSG Application Class followed by message » 6: Return estimated operating expenses for week in the other direction

111 Slide 11.111 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 5 – In Steps 3, 4, and 5 of the scenario, two estimates are determined » the estimated grants for the week, and » the estimated payments for the week – This is modeled by message » 7: Request estimated grants and payments for week from : Estimate Funds for Week Class to : Mortgage Class, and by message » 8: Return estimated grants and payments for week in the other direction

112 Slide 11.112 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 6 – Now the arithmetic computation of Step 6 of the scenario is performed – This is modeled by message » 9: Compute estimated amount available for week – This is a self call – : Estimate Funds for Week Class tells itself to perform the calculation – The result of the computation is stored in : MSG Application Class by message » 10: Transfer estimated amount available for week

113 Slide 11.113 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 7 – The result is printed in Step 7 of the scenario – This is modeled by message » 1 1: Print estimated amount available – from : MSG Application Class to : Estimated Funds Report Class

114 Slide 11.114 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Item 8 – Finally, an acknowledgment is sent to the MSG staff member that the task has been successfully completed – This is modeled by messages » 12: Send successful completion message » 13: Send successful completion message » 14: Transfer successful completion message, and » 15: Display successful completion message

115 Slide 11.115 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l No client will approve the specification document without understanding it l Accordingly, a written description of the communication diagram is needed, the flow of events

116 Slide 11.116 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l The flow of events of the communication diagram of the realization of the scenario of the use case Figure 11.34

117 Slide 11.117 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Sequence diagram equivalent to the communication diagram (of the realization of the scenario of the use case) Figure 11.35

118 Slide 11.118 Copyright © 2008 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 communication diagram l A communication diagram is similar to a class diagram – When the developers are concentrating on the classes, a communication diagram is more useful than the equivalent sequence diagram

119 Slide 11.119 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figures 11.29 through 11.35 do not depict a random collection of UML artifacts l Instead, these figures depict a use case and artifacts derived from that use case l In more detail (see next slide):

120 Slide 11.120 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) Figure 11.29 depicts the use case Estimate Funds Available for Week l The figure models – All possible sets of interactions – Between the actor MSG Staff Member (external to the software product) and the MSG Foundation software product itself – That relate to the action of estimating funds available for the week

121 Slide 11.121 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figure 11.30 is the description of that use case The figure provides a written account of the details of the Estimate Funds Available for Week use case of Figure 11.29

122 Slide 11.122 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) Figure 11.31 is a class diagram showing the classes that realize the Estimate Funds Available for Week use case l The figure depicts – The classes that are needed to model all possible scenarios of the use case – Together with their interactions

123 Slide 11.123 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figure 11.32 is a scenario l It depicts one specific instance of the use case of Figure 11.29

124 Slide 11.124 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figure 11.33 is a communication diagram of the realization of the scenario of Figure 11.32 l The figure depicts the objects and the messages sent between them in the realization of that one specific scenario

125 Slide 11.125 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figure 11.34 is the flow of events of the communication diagram of the realization of the scenario of Figure 11.32 l Figure 11.34 is a written description of the realization of the scenario of Figure 11.32 – (Compare: Figure 11.30 is a written description of the Estimate Funds Available for Week use case of Figure 11.29)

126 Slide 11.126 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Figure 11.35 is the sequence diagram that is fully equivalent to the communication diagram of Figure 11.33 l The sequence diagram depicts the objects and the messages sent between them in the realization of the scenario of Figure 11.32 l Its flow of events is therefore also shown in Figure 11.34

127 Slide 11.127 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18.2 Manage an Asset Use Case l Use case Figure 11.36

128 Slide 11.128 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. l Description of use case Manage an Asset Use Case (contd) Figure 11.37

129 Slide 11.129 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Class diagram showing the classes that realize the use case Figure 11.38

130 Slide 11.130 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l One scenario of the use case Figure 11.39

131 Slide 11.131 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Communication diagram of the realization of the scenario of the use case Figure 11.40

132 Slide 11.132 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) Object : Investment Class does not play an active role in this communication diagram – This scenario does not involve an investment, only a mortgage l Actor Borrowers does not play a role in this use case, either

133 Slide 11.133 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) ●Sequence diagram equivalent to the communication diagram (of the realization of the scenario of the use case) Figure 11.41

134 Slide 11.134 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l A different scenario of the use case Figure 11.42

135 Slide 11.135 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Communication diagram of the realization of the scenario of the use case Figure 11.43

136 Slide 11.136 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l At the request of the borrowers, the MSG staff member updates the weekly income of a couple The scenario is initiated by the Borrowers Their data are entered into the software product by the MSG Staff Member – This is stated in the note in the communication diagram

137 Slide 11.137 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Sequence diagram equivalent to the communication diagram (of the realization of the scenario of the use case) Figure 11.44

138 Slide 11.138 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Two different scenarios of the same use case have been presented l The use case is the same – The class diagram is therefore the same l However, the communication (and sequence) diagrams reflect the differences between the two scenarios

139 Slide 11.139 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) Boundary class User Interface Class appears in all the realizations – The same screen will be used for all commands of the information system l Revised menu Figure 11.45

140 Slide 11.140 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Corresponding textual interface Figure 11.46

141 Slide 11.141 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18.3 Update Estimated Annual Operating Expenses Use Case l Class diagram Figure 11.47

142 Slide 11.142 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Update Annual Operating Expenses Use Case (contd) l Communication diagram of a realization of a scenario of the use case Figure 11.48

143 Slide 11.143 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Update Annual Operating Expenses Use Case (contd) l Equivalent sequence diagram Figure 11.49

144 Slide 11.144 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18.4 Produce a Report Use Case l Use case Figure 11.50

145 Slide 11.145 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Description of use case Figure 11.51

146 Slide 11.146 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Class diagram Figure 11.52

147 Slide 11.147 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l One scenario of the use case Figure 11.53

148 Slide 11.148 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Communication diagram – Mortgages (but not investments) are involved Figure 11.54

149 Slide 11.149 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Sequence diagram Figure 11.55

150 Slide 11.150 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l A second scenario (listing all investments) of the use case Figure 11.56

151 Slide 11.151 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Communication diagram for second scenario – This time, investments (but not mortgages) are involved Figure 11.57

152 Slide 11.152 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case (contd) l Sequence diagram for second scenario Figure 11.58

153 Slide 11.153 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.19 Incrementing the Class Diagram: The MSG Foundation l In the course of realizing the various use cases – Interrelationships between classes become apparent l Accordingly, we now combine the realization class diagrams

154 Slide 11.154 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Combining the Realization Class Diagrams Figure 11.59

155 Slide 11.155 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. l Third iteration + realization class diagram Fourth Iteration of the Class Diagram Figure 11.60

156 Slide 11.156 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. l As with the classical paradigm, the SPMP is drawn up at this point – It appears in Appendix E – The plan conforms to the IEEE SPMP format 11.20 Software Project Management Plan: MSG Foundation

157 Slide 11.157 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. l CRC cards are used to check the entity classes l All the artifacts are then inspected 11.21 The Test Workflow: MSG Foundation

158 Slide 11.158 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.22 The Specification Document in the Unified Process l The Unified Process is use-case driven – The use cases and the artifacts derived from them replace the traditional textual specification document l The client must be shown each use case and associated artifacts, both diagrammatic and textual – These UML diagrams convey to the client more information more accurately than the traditional specification document – The set of UML diagrams can also play the same contractual role as the traditional specification document

159 Slide 11.159 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document (contd) l A scenario is a specific execution sequence l The client can therefore appreciate how the product works equally well from – A use case together with its scenarios, or – A rapid prototype l The difference is – The use cases are successively refined, with more information added each time, whereas – The rapid prototype is discarded

160 Slide 11.160 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document (contd) l However, a rapid prototype of the user interface is required – Specimen screens and reports are needed (not a complete rapid prototype)

161 Slide 11.161 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.23 More on Actors and Use Cases l To find the actors, consider every role in which an individual can interact with the software product – Example: Applicants, Borrowers l Actors are not individuals – They are roles played by those individuals l Find all the different roles played by each user – From the list of roles, extract the actors

162 Slide 11.162 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. More on Actors and Use Cases (contd) l In the Unified Process – The term worker is used to denote a role played by an individual – In the Unified Process, Applicants and Borrowers are two different workers l In common parlance – The word “worker” usually refers to an employee l In this book, the word “role” is used in place of “worker”

163 Slide 11.163 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. More on Actors and Use Cases (contd) l Within a business context, finding the roles is easy – They are displayed within the use-case business model l To find the actors – Find the subset of the use-case business model that corresponds to the use-case model of the requirements

164 Slide 11.164 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. More on Actors and Use Cases (contd) l To find the actors (in more detail): – Construct the use-case business model – Consider only those parts of the business model that correspond to the proposed software product – The actors in this subset are the actors we seek

165 Slide 11.165 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. More on Actors and Use Cases (contd) l Within a business context, finding use cases is easy l For each role, there will be one or more use cases – Find the actors (see previous slide) – The use cases then follow

166 Slide 11.166 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.24 CASE Tools for the Analysis Workflow l Diagrams play a major role in the analysis workflow l Diagrams often change – We need a diagramming tool – Many tools go further l All modern tools support UML – Commercial examples » IBM Rational Rose » Together – Open-source example » ArgoUML

167 Slide 11.167 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.25 Challenges of the Analysis Workflow l Do not cross the boundary into the design workflow l Do not allocate methods to classes yet – Reallocating methods to classes during stepwise refinement is wasted effort


Download ppt "Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen."

Similar presentations


Ads by Google