Slide 12 C 50 ObjectOriented and Classical Software
Slide 12 C. 50 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 C OBJECT-ORIENTED ANALYSIS © The Mc. Graw-Hill Companies, 2005 Slide 12 C. 51
Slide 12 C. 52 Continued from Unit 12 B © The Mc. Graw-Hill Companies, 2005
12. 10 The Initial Class Diagram: The Osbert Oglesby Case. Slide. Study 12 C. 53 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 © The Mc. Graw-Hill Companies, 2005
Noun Extraction: Osbert Oglesby Case Study Slide 12 C. 54 l Stage 1: Describe the software product in one paragraph: 4 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 Mc. Graw-Hill Companies, 2005
Noun Extraction: Osbert Oglesby (contd) Slide 12 C. 55 l Stage 2: Identify the nouns in this paragraph 4 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 Mc. Graw-Hill Companies, 2005
Noun Extraction: Osbert Oglesby (contd) Slide 12 C. 56 l The nouns are report, effectiveness, process, buying, work of art, selling, information, painting, masterpiece, and masterwork l effectiveness, process and information are abstract nouns and are therefore unlikely to be entity classes l Nouns buying and selling are derived from the verbs “buy” and “sell” 4 They will probably be operations of some class © The Mc. Graw-Hill Companies, 2005
Noun Extraction: Osbert Oglesby (contd) Slide 12 C. 57 l Noun report is much more likely to be a boundary class than an entity class l Noun work of art is just a synonym for painting © The Mc. Graw-Hill Companies, 2005
First Iteration of the Initial Class Diagram Slide 12 C. 58 l This leaves four candidate entity classes: 4 Painting Class, Masterpiece Class, Masterwork Class, and Other Painting Class © The Mc. Graw-Hill Companies, 2005 Figure 12. 17
Second Iteration of the Initial Class Diagram Slide 12 C. 59 l Consider the interrelationships between the entity classes l A masterpiece is a specific type of painting, and so is a masterwork and an “other painting” 4 Painting Class is therefore the base class 4 Masterpiece Class, Masterwork Class, and Other Painting Class are subclasses of that base class © The Mc. Graw-Hill Companies, 2005
Second Iteration of Initial Class Diagram (contd) Slide 12 C. 60 Figure 12. 18 © The Mc. Graw-Hill Companies, 2005
Third Iteration of the Initial Class Diagram Slide 12 C. 61 l The class diagram does not reflect aspects of the pricing algorithm l When dealing with a masterwork 4“The software product first computes the maximum purchase price as if it were a masterpiece by the same artist” © The Mc. Graw-Hill Companies, 2005
Third Iteration of the Initial Class Diagram (contd) Slide 12 C. 62 l 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 4 This is modeled in the next slide © The Mc. Graw-Hill Companies, 2005
Third Iteration of the Initial Class Diagram (contd) Slide 12 C. 63 © The Mc. Graw-Hill Companies, 2005 Figure 12. 19
Fourth Iteration of the Initial Class Diagram Slide 12 C. 64 l Another aspect of the pricing algorithm that is not reflected in the current class diagram is 4“The software product computes the coefficient of similarity between each painting for which there is an auction record and the painting under consideration for purchase” © The Mc. Graw-Hill Companies, 2005
Fourth Iteration of Initial Class Diagram (contd) Slide 12 C. 65 l Auctioned Painting Class is needed to make these comparisons 4 An auctioned painting must be a subclass of Painting Class 4 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 © The Mc. Graw-Hill Companies, 2005
Fourth Iteration of Initial Class Diagram (contd) Slide 12 C. 66 © The Mc. Graw-Hill Companies, 2005 Figure 12. 20
Fourth Iteration of Initial Class Diagram (contd) Slide 12 C. 67 l An instance of Painting Class is either 4 A painting that Osbert has bought (an instance of Gallery Painting Class), or 4 A painting sold at some auction (an instance of Auctioned Painting Class) © The Mc. Graw-Hill Companies, 2005
Fifth Iteration of the Initial Class Diagram Slide 12 C. 68 l A third aspect of the maximum price algorithm that has not yet been modeled is fashionability 4“The software product computes the maximum purchase price from the formula F A , where F is a constant for that artist (fashionability coefficient) …” l Fashionability Class is needed 4 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 © The Mc. Graw-Hill Companies, 2005
Fifth Iteration of the Initial Class Diagram (contd) Slide 12 C. 69 © The Mc. Graw-Hill Companies, 2005 Figure 12. 21
Initial Class Diagram: Osbert Oglesby (contd) Slide 12 C. 70 l Why was the first iteration of the class diagram so inadequate? 4 The Osbert Oglesby case study appears to be a straightforward data-processing application 4 The one-paragraph description correctly did not incorporate the pricing algorithm l Unfortunately, the algorithmic details turned out to be critical to the class diagram © The Mc. Graw-Hill Companies, 2005
Initial Class Diagram: Osbert Oglesby (contd) Slide 12 C. 71 l The first iteration of the class diagram was no good 4 However, repeated iteration and incrementation led to a reasonable class diagram l This demonstrates the power of the iterative and incremental approach © The Mc. Graw-Hill Companies, 2005
Initial Class Diagram: Osbert Oglesby (contd) Slide 12 C. 72 l Finally, we add the attributes of each class to the class diagram 4 For the Osbert Oglesby 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 © The Mc. Graw-Hill Companies, 2005
Fifth Iteration of the Initial Class Diagram (contd) Slide 12 C. 73 © The Mc. Graw-Hill Companies, 2005 Figure 12. 22
Fifth Iteration of the Initial Class Diagram (contd) Slide 12 C. 74 l Osbert Oglesby Application Class will contain the operation that starts execution of the whole software product © The Mc. Graw-Hill Companies, 2005
Fifth Iteration of the Initial Class Diagram (contd) Slide 12 C. 75 l The next slide shows the fifth iteration of the initial class diagram, without the attributes, but explicitly reflecting the stereotypes 4 All eight classes in that figure are entity classes l This is also a class diagram 4 A class diagram depicts classes and their interrelationships; attributes and operations are optional © The Mc. Graw-Hill Companies, 2005
Fifth Iteration of the Initial Class Diagram (contd) Slide 12 C. 76 Figure 12. 23 © The Mc. Graw-Hill Companies, 2005
12. 11 The Initial Dynamic Model: The Osbert Oglesby Case Study Slide 12 C. 77 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 © The Mc. Graw-Hill Companies, 2005
Initial Dynamic Model: Osbert Oglesby (contd) Slide 12 C. 78 l Initial statechart Figure 12. 24 © The Mc. Graw-Hill Companies, 2005
Initial Dynamic Model: Osbert Oglesby (contd) Slide 12 C. 79 l The solid circle (top left) represents the initial state l The white circle with the small black circle inside (top right) represents the final state l States other than the initial and final states are represented by rectangles with rounded corners l The arrows represent transitions from state to state © The Mc. Graw-Hill Companies, 2005
Initial Dynamic Model: Osbert Oglesby (contd) Slide 12 C. 80 l In state Osbert Oglesby Event Loop, one of five events can occur: 4 buy painting selected 4 sell painting selected 4 print report selected 4 update fashionability selected 4 quit selected © The Mc. Graw-Hill Companies, 2005
Initial Main Menu: Osbert Oglesby l Graphical user interface (GUI) 4“Point and click” Figure 12. 25 © The Mc. Graw-Hill Companies, 2005 Slide 12 C. 81
Dynamic Modeling (contd) l Slide 12 C. 82 In the object-oriented paradigm, there is a dynamic model for each class, rather than for the system as a whole, as in this case study 4 However, objects in this software product never move from one class to another class l Accordingly, a dynamic model for the software product as a whole is appropriate © The Mc. Graw-Hill Companies, 2005
12. 12 Extracting the Boundary Classes: The Osbert Oglesby Case Study Slide 12 C. 83 l It is usually easy to extract boundary classes 4 Each input screen, output screen, and printed report is generally modeled by a boundary class l One screen should be adequate for all four Osbert Oglesby use cases l Thus there is one initial boundary class 4 User Interface Class © The Mc. Graw-Hill Companies, 2005
Initial Main Menu: Osbert Oglesby (contd) Slide 12 C. 84 l A GUI needs special software 4 However, a textual interface runs on all computers Figure 12. 26 © The Mc. Graw-Hill Companies, 2005
Initial Boundary Classes: Osbert Oglesby (contd) Slide 12 C. 85 l There are three reports: 4 The purchases report 4 The sales report 4 The future trends report l The content of each report is different 4 Each report therefore has to be modeled by a separate boundary class © The Mc. Graw-Hill Companies, 2005
Initial Boundary Classes: Osbert Oglesby (contd) Slide 12 C. 86 l There are therefore four initial boundary classes Figure 12. 27 © The Mc. Graw-Hill Companies, 2005
Slide 12 C. 87 Continued in Unit 12 D © The Mc. Graw-Hill Companies, 2005
- Slides: 38