THE ANALYSIS WORKFLOW I GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter Overview • • • • • • • • • • • The Analysis Workflow Extracting Entity Classes Initial Functional Model: Osbert Oglesby Case Study Initial Class diagram: Osbert Oglesby Case Study Initial Dynamic Model: Osbert Oglesby Case Study Extracting Boundary Classes Extracting Control Classes Refining the Use Cases Use-Case Realization Incrementing the Class Diagram Where’s the Specification Document? GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Aims of the Analysis Workflow • To obtain a deeper understanding of the requirements • To describe the requirements in a way that is – Easy to maintain, and – Provides insights into the structure of the target information system GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Classes • The three class types in the Unified Process are – Entity classes – Boundary classes – Control classes • UML notation GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Entity Classes • An entity class models information that is long lived • Examples: – Account Class in a banking information system – Painting Class in the Osbert Oglesby information system – Mortgage Class and Investment Class in the MSG Foundation information system • Instances of all these classes remain in the information system for years GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Boundary Classes • A boundary class models the interaction between the information system and its actors • Boundary classes are generally associated with input and output • Examples: – Purchases Report Class and Sales Report Class in the Osbert Oglesby information system – Mortgage Listing Class and Investment Listing Class in the MSG Foundation information system GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Control Classes A control class models complex computations and algorithms Examples: – Compute Masterpiece Price Class, – Compute Masterwork Price Class, and – Compute Other Painting Price Class in the Osbert Oglesby information system GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Stereotypes • UML notation for these three types of classes • These are stereotypes (extensions of UML) – UML allows us to define additional constructs that are not part of UML but which we need in order to model a system accurately GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process and Classes • The Unified Process does not describe how classes are extracted – Users of the Unified Process are expected to have a background in object-oriented analysis and design • We temporarily suspend this discussion of the Unified Process to explain how classes are extracted, and then return to the Unified Process GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Extracting Entity Classes • Entity class extraction consists of three steps that are carried out iteratively and incrementally: – 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 GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Flowchart for Extracting Entity Classes GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Functional Model: Osbert Oglesby • Recall the Osbert Oglesby use-case diagram: GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Use Case and Scenario • A use case depicts all possible interactions of a specific kind • A scenario is an instance of a use case – (Just as an object is an instance of a class) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Scenario of Use Case Buy a Painting GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Scenario of Use Case Buy a Painting (contd) • This is a normal scenario • There are six paragraphs in the scenario – Only four of them are numbered – The two unnumbered sentences • “Osbert wishes to buy a masterpiece” and • “Osbert makes an offer below the maximum purchase price—the offer is accepted by the seller” have nothing to do with the interaction between Osbert and the information system – These unnumbered paragraphs are essentially comments GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Scenario of Use Case Buy a This is an exceptionPainting scenario – It models an interaction that is not “normal” GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Third Scenario of Use Case Buy a Painting This is another exception scenario GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Normal and Exception Scenarios • Normal and exception scenarios can be combined into an extended scenario GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Functional Model (contd) • The systems analysis team investigates as many normal and exception scenarios of each use case as time permits – To get the deepest possible understanding of • The domain • The business model, and • The use cases GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Class Diagram: Osbert Oglesby Case Study • The second step in extracting the entity classes is class modeling – The aim of this step is to extract the entity classes, determine their interrelationships, and find their attributes • Usually, the best way to begin this step is to use the two-stage noun extraction method – Stage 1: Describe the information system in a single paragraph – Stage 2: Identify the nouns in this paragraph, then select the entity classes from those nouns GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: Osbert Oglesby Case Study • Stage 1: Describe the information system in one paragraph: – Reports are to be generated in order to improve the effectiveness of the decision-making process for buying works of art. The reports contain buying and selling information about paintings, which are classified as masterpieces, masterworks, and other paintings GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: Osbert Oglesby (contd) • Stage 2: Identify the nouns in this paragraph – Reports are to be generated in order to improve the effectiveness of the decision-making process for buying works of art. The reports contain buying and selling information about paintings, which are classified as masterpieces, masterworks, and other paintings • The nouns are report, effectiveness, process, buying, work of art, selling, information, painting, masterpiece, and masterwork GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: Osbert Oglesby (contd) • effectiveness, process and information are abstract nouns and are therefore unlikely to be entity classes – Abstract nouns identify things that have no physical existence • Nouns buying and selling are derived from the verbs “buy” and “sell” – They will probably be operations of some class GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction: Osbert Oglesby (contd) • Noun report is unlikely to be an entity class, because a report is not long lived – A report is much more likely to be a boundary class • Noun work of art is just a synonym for painting GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. First Iteration of the Initial Class Diagram • This leaves four candidate entity classes: – Painting Class, Masterpiece Class, Masterwork Class, and Other Painting Class GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the Initial Class Diagram • Consider the interrelationships between the entity classes • A masterpiece is a specific type of painting, and so is a masterwork and an “other painting” – Painting Class is therefore the base class – Masterpiece Class, Masterwork Class, and Other Painting Class are subclasses of that base class GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Initial Class Diagram (contd) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of the Initial Class Diagram • The class diagram does not reflect aspects of the pricing algorithm • When dealing with a masterwork – “The information system first computes the maximum purchase price as if it were a masterpiece by the same artist” GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of the Initial Class Diagram (contd) • That is, a masterwork has to have all the attributes of a masterpiece (so that its maximum purchase price can be computed as if it were a masterpiece) and, in addition, it may have attributes of its own – This is modeled in the next slide GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of the Initial Class Diagram (contd) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fourth Iteration of the Initial Class Diagram • Another aspect of the pricing algorithm that is not reflected in the current class diagram is – “The information system computes the coefficient of similarity between each painting for which there is an auction record and the painting under consideration for purchase” GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fourth Iteration of the Initial Class Diagram (contd) • Auctioned Painting Class is needed to make these comparisons – An auctioned painting must be a subclass of Painting Class – But a painting previously been sold at an auction somewhere in the world has nothing to do with paintings currently on display for sale in Osbert’s gallery GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fourth Iteration of the Initial Class Diagram (contd) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fourth Iteration of the Initial Class Diagram (contd) • An instance of Painting Class is either – A painting that Osbert has bought (an instance of Gallery Painting Class), or – A painting sold at some auction (an instance of Auctioned Painting Class) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fifth Iteration of the Initial Class Diagram • A third aspect of the maximum price algorithm that has not yet been modeled is fashionability – “The information system computes the maximum purchase price from the formula F A , where F is a constant for that artist (fashionability coefficient) …” • Fashionability Class is needed – A painting of Other Painting Class can then use the instance of Fashionability Class for that artist to compute the maximum price that Osbert should offer to pay GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fifth Iteration of the Initial Class Diagram (contd) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Class Diagram: Osbert Oglesby Study • Why was the first Case iteration of the class diagram so inadequate? – The Osbert Oglesby case study appears to be a straightforward data-processing application – The one-paragraph description correctly did not incorporate the pricing algorithm • Unfortunately, the algorithmic details turned out to be critical to the class diagram GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Class Diagram: Osbert Oglesby (contd) • The first iteration of the class diagram was no good – However, repeated iteration and incrementation led to a reasonable class diagram • This demonstrates the power of the iterative and incremental approach GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Initial Class Diagram (contd) • Finally, we add the attributes of each class to the class diagram – For the Osbert Oglesby case study, the result is shown on the next slide • The empty rectangle at the bottom of each box will later be filled with the operations of that class GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fifth Iteration of the Initial Class Diagram (contd) GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fifth Iteration of the Initial Class Diagram (contd) • Osbert Oglesby Application Class will contain the operation that starts execution of the whole information system GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Fifth Iteration of the Initial Class Diagram (contd) • The next slide shows the fifth iteration of the initial class diagram, without the attributes, but explicitly reflecting the stereotypes – All eight classes in that figure are entity classes, that is, they model long-lived information • This is also a class diagram – A class diagram depicts classes and their interrelationships; attributes and operations are optional GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Continued in Unit 6B GGN/APS/SCS/VIT UniversityVellore-14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.