Slide 7A.1 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 7 — Unit A Slide 7A.2 THE ANALYSIS WORKFLOW II Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter Overview Slide 7A.3 Extracting Entity Classes: MSG Foundation Case Study Initial Functional Model: MSG Foundation Case Study Initial Class Diagram: MSG Foundation Case Study Back to the Requirements Workflow Initial Dynamic Model: MSG Foundation Case Study Revising the Entity Classes: MSG Foundation Case Study Extracting Boundary Classes: MSG Foundation Case Study Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter Overview (contd) Slide 7A.4 Extracting Control Classes: MSG Foundation Case Study Use-Case Realization: MSG Foundation Case Study Incrementing the Class Diagram More on Actors More on Use Cases Risk Rapid Prototyping Scenarios and the Client’s Needs Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Extracting Entity Classes: MSG Foundation Slide 7A.5 Entity class extraction is performed by iterating three steps – Functional modeling – Class modeling – Dynamic modeling Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Extracting Entity Classes: MSG Foundation Slide 7A.6 The first step is to perform functional modeling Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Functional Model: MSG Foundation Slide 7A.7 The seventh iteration of the use-case diagram Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Manage a Mortgage Use Case One possible extended scenario Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 7A.8 Manage a Mortgage Use Case (contd) A second extended scenario Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 7A.9 Estimate Funds Available for Week Use Case Slide 7A.10 One possible scenario Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Produce a Report Use Case One possible scenario Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 7A.11 Produce a Report Use Case (contd) Another possible scenario Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 7A.12 Class Modeling Slide 7A.13 The second step of entity class extraction is class modeling – The two-stage noun extraction method is used Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation Slide 7A.14 Stage 1: Describe the information system 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. Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation (contd) Slide 7A.15 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. The nouns are report, money, mortgage, list, and investment Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: MSG Foundation (contd) Slide 7A.16 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), money is an abstract noun This leaves two candidate entity classes – Mortgage Class and Investment Class Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. First Iteration of the Initial Class Diagram Slide 7A.17 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the Initial Class Diagram Slide 7A.18 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Initial Class Diagram (contd) Slide 7A.19 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Back to the Requirements Workflow Slide 7A.20 The current 5 use cases include Manage a Mortgage and Manage an Investment These can now be combined into a single use case, Manage an Asset Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Eighth Iteration of the Use-Case Diagram Slide 7A.21 The new use case is shaded Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Initial Class Diagram (contd) Slide 7A.22 Now the attributes are added Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Iteration and Incrementation Slide 7A.23 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Dynamic Model: MSG Foundation Slide 7A.24 The third step is dynamic modeling – A statechart is drawn that reflects all the operations, showing the events that cause the transition from state to state The major source of information regarding the relevant operations is the scenarios Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study Slide 7A.25 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.26 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.27 In state MSG Foundation Information System Loop, one of five events can occur 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.28 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 An event causes a transition between states Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.29 An MSG staff member selects an option by clicking on the menu This graphical user interface (GUI) requires special software Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.30 Here is an equivalent textual user interface that can run on any computer Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Statechart: MSG Foundation Case Study (contd) Slide 7A.31 Example: – The MSG staff member clicks on the choice Manage an asset – The event “manage an asset selected” has now occurred – The system moves from its current state, MSG Foundation Information System Loop, to the state Managing an Asset – The operations that the MSG staff member can perform in this state » Add, delete, or modify a mortgage or investment appear below the line in the box with rounded corner Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Revising the Entity Classes: MSG Case Study Slide 7A.32 The initial functional model, the initial class diagram, and the initial dynamic model are completed – Checking them reveals a fault 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Revising the Entity Classes: MSG (contd) Slide 7A.33 But where is the value of the estimated annual operating expenses to be found? Currently there is only one class (Asset Class) and its two subclasses – Neither is appropriate for storing the estimated annual operating expenses Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Revising the Entity Classes: MSG (contd) Slide 7A.34 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 Another entity class is needed in which the estimated annual operating expenses can be stored – MSG Application Class Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Third iteration of the initial class diagram: MSG Slide 7A.35 MSG Application Class has other attributes as well – Attributes that do not appertain to the assets Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 7A.36 Continued in Unit 7B Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.