Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 8B.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 8B.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 8B.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 8B.2 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 8 — Unit B THE OBJECT-ORIENTED DESIGN WORKFLOW

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

4 Slide 8B.4 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Responsibility-Driven Design: Osbert Oglesby l Consider operation getAuctionPrice l Irrespective of the source of the message requesting an auction price –Operation getAuctionPrice must be allocated to Auctioned Painting Class

5 Slide 8B.5 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Responsibility-Driven Design: Osbert Oglesby l Allocation of getAuctionPrice

6 Slide 8B.6 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study l Consider operations –setTitle and –getTitle

7 Slide 8B.7 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study (contd) l Example: Osbert prints a list of all his paintings –Each object in the information system in turn is examined –A message is sent to operation getTitle to obtain the title of the painting represented by that object l To which class must operations –setTitle and –getTitle be allocated?

8 Slide 8B.8 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study (contd) l First consider operation setTitle l In the traditional paradigm, there would have to be three different versions of setTitle, one for each type of painting –set_masterpiece_title –set_masterwork_title –set_other_painting_title l That is because the traditional paradigm does not support inheritance

9 Slide 8B.9 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study (contd) l In the object-oriented paradigm, consider the Painting Class inheritance hierarchy l Painting Class has attribute title –This attribute is inherited by instances of its 5 subclasses »Gallery Painting Class »Auctioned Painting Class »Masterpiece Class »Masterwork Class »Other Painting Class

10 Slide 8B.10 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study (contd) l Thus, operation setTitle must be allocated to Painting Class so that it can be inherited (and used) by instances of all five subclasses l This applies to all operations, including getTitle

11 Slide 8B.11 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance: Osbert Oglesby Case Study (contd) l Allocation of operations setTitle and getTitle

12 Slide 8B.12 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards l Since 1990, class-responsibility-collaboration (CRC) cards have been utilized for object-oriented analysis and design l For each class, fill in a card showing –The name of the class; –The functionality of that class (its responsibility); and –The other classes it invokes to achieve that functionality (its collaboration)

13 Slide 8B.13 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l CRC cards were originally introduced for performing requirements elicitation and analysis l They are excellent for this purpose –Provided the team members are familiar with the domain l For professionals who have no domain expertise –CRC cards are an extremely effective way of testing object-oriented analysis and design artifacts

14 Slide 8B.14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Example:

15 Slide 8B.15 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The data for the CRC card are obtained from the realizations of all the use cases

16 Slide 8B.16 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Consider the MSG collaboration diagram

17 Slide 8B.17 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The message –7: Request estimated grants and payments for week is passed from : Estimate Funds for Week Class to : Mortgage Class, followed by the message –8: Return estimated grants and payments for week in the reverse direction

18 Slide 8B.18 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Mortgage Class therefore has a responsibility to –Compute estimated grants and payments for week l In order to do this, it must collaborate with Estimate Funds for Week Class –This is shown in the first entry in the CRC card

19 Slide 8B.19 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Consider the MSG collaboration diagram

20 Slide 8B.20 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The message –3: Update tax and date is passed from : Manage an Asset Class to : Mortgage Class l Then, the message –4: Send successful completion message is passed back

21 Slide 8B.21 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Third iteration of the MSG initial class diagram

22 Slide 8B.22 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Mortgage Class has eight attributes (including annual real-estate tax), that might need to be changed by : Manage an Asset Class –All the attributes are initialized by : Manage an Asset Class l A complete set of scenarios includes all 16 set and get operations

23 Slide 8B.23 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Each of the 16 scenarios in turn requires an interaction diagram of its realization –In addition, managing a mortgage includes adding a new mortgage and deleting an existing mortgage l For brevity, combine all these responsibilities into responsibility –Initialize, update, and delete mortgages with collaborator –Manage an Asset Class l This is the second entry in the CRC card

24 Slide 8B.24 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Consider the MSG collaboration diagram

25 Slide 8B.25 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The message –3: Update income and date is passed from : Manage an Asset Class to : Mortgage Class l The message –4: Send successful completion message is then passed back

26 Slide 8B.26 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Attribute combinedWeeklyIncome is one of the eight attributes of Mortgage Class that might need to be changed by : Manage an Asset Class –This responsibility is already included in responsibility Initialize, update, and delete mortgages

27 Slide 8B.27 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Consider the MSG collaboration diagram

28 Slide 8B.28 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The message –2: Transfer request [for list of mortgages] is passed from : User Interface Class to : Mortgage Class l Thus, Mortgage Class has the responsibility –Generate list of mortgages with collaborator User Interface Class l This is the third entry in the CRC card

29 Slide 8B.29 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Also, the message –3: Print list of mortgages is passed from : Mortgage Class to : Mortgages Report Class l Mortgage Class thus also has the responsibility –Print list of mortgages with collaborator Mortgages Report Class l This is the fourth entry in the CRC card

30 Slide 8B.30 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l As a check, consider the fourth iteration of the MSG class diagram

31 Slide 8B.31 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l In the class diagram there five classes with which Mortgage Class has a relationship –User Interface Class –Estimate Funds for Week Class –Mortgages Report Class –Asset Class –Manage an Asset Class l From the realizations it is clear that Mortgage Class no responsibility with Asset Class

32 Slide 8B.32 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l All four of the remaining classes are listed in the COLLABORATION column of the CRC card l This does not necessarily mean that every responsibility of every collaboration class has been included –However, it is likely that all the collaboration classes have been included

33 Slide 8B.33 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l CRC cards have been extended l A CRC card nowadays often contains the attributes and operations of a class, not its “responsibility” –The CRC card then contains the information of the complete class diagram

34 Slide 8B.34 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l The technology has changed –Instead of using cards, some organizations move Post-it notes around on a white board and draw lines between them to denote collaboration l Nowadays the whole process can be automated –Some CASE tools include modules for creating and updating CRC “cards” on the screen

35 Slide 8B.35 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l When used by a team, CRC cards can highlight missing or incorrect attributes or operations l Having the members of the team act out the responsibilities of each CRC card is an effective means of verifying that the classes are correct l Example: –One team member acting out the responsibilities of a class may cause another member to realize that a needed responsibility has been omitted


Download ppt "Slide 8B.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