COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

17
COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis

Transcript of COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Page 1: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

COP 4331 – OOD&P

Lecture 9

Object-Oriented Analysis

Page 2: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Object-Oriented Analysis

• Sample problem taken from Object-Oriented Modeling and Design by James Rumbaugh, et.al., Prentice Hall, 1991.

• Automated Teller Machine

Page 3: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

ATM Problem StatementDesign the software to support a computerized banking network including both human cashiers and automatic teller machines (ATMs) to be shared by a consortium of banks. Each bank provides its own computer to maintain its own accounts and processes transactions against them. Cashier stations are owned by individual banks and communicate directly with their own bank's computers. Human cashiers enter account and transaction data. Automatic teller machines communicate with a central computer which clears transactions with the appropriate banks.

Page 4: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

ATM Problem Statement (cont.)

An automatic teller machine accepts a cash card, interacts with the user, communicates with the central system to carry out the transaction, dispense cash, and prints receipts. The system requires appropriate recordkeeping and security provisions. The system must handle concurrent access to the same account correctly. The banks will provide their own software for their own computers; you are to design the software for the ATMs and the network. The cost of the shared system will be apportioned to the banks according to the number of customers with cash cards.

Page 5: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Object Classes

1. Extract nouns from problem statement2. Eliminate spurious classes• Candidate nouns

Software, Banking Network, Cashier, ATM, Consortium, Bank, Bank Computer, Account, Transaction, Cashier Station, Account Data, Transaction Data, Central Computer, Cash Card, User, Cash, Receipt, System, Recordkeeping Provision, Security Provision, Access, Cost, Customer

Page 6: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Object Classes.2

• Characteristics of unnecessary or incorrect classes

– Redundant– Irrelevant– Vague– Attributes– Operations– Roles– Implementation Constructs

Page 7: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Object Classes.3

• Classes Eliminated– Vague: System, Recordkeeping Provision,

Security Provision, Banking Network– Redundant: User– Irrelevant: Cost– Attribute: Account Data, Receipt, Cash,

Transaction Data– Implementation: Access, Software

Page 8: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Object Classes.4

• Remaining, Good Classes– Account, ATM, Bank, Bank Computer, Cash

Card, Cashier, Cashier Station, Central Computer, Consortium, Customer, Transaction

• Note: It is sometimes necessary to add classes based on domain knowledge that are not part of the problem statement

Page 9: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations

• Associations often correspond to stative verbs or verb phrases including– Location– Directed actions– Communication– Ownership– Satisfaction of a condition

Page 10: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations.2

• Candidate verb phrases– Banking network includes cashiers and ATMs– Consortium shares ATMs– Bank provides bank computer– Bank computer maintain accounts– Bank computer processes transaction against

account– Bank owns cashier station– Cashier station communicates with bank computer– Cashier enters transaction for account

Page 11: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations.2

• Candidate verb phrases (cont.)– ATMs communicate with bank computer– Central computer clears transaction with bank– ATM accepts cash card– ATM interacts with user– ATM dispenses cash– ATM prints receipt– System handles concurrent access– Banks provide software– Cost apportioned to banks

Page 12: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations.3

• Implicit verb phrases– Consortium consists of banks– Bank holds account– Consortium owns central computer– System provides recordkeeping– System provides security– Customers have cash cards

• Problem domain relationships– Cash card accesses accounts– Bank employs cashiers

Page 13: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations.4

• Discard unnecessary or incorrect associations– Associations involving eliminated classes– Irrelevant or implementation associations– Actions– Derived associations– Ternary associations– Misnamed associations– Role names– Qualified associations

• Seek missing associations

Page 14: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Identifying Associations.4

– Associations involving eliminated classes• Costs, receipts, cash, system, software

– Irrelevant or implementation associations• Concurrent access

– Actions• Accepts cash card, Interacts with user

– Ternary associations• Processes transaction against account

– Derived associations– Misnamed associations– Role names– Qualified associations

Page 15: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Adding Attributes

• Attributes are properties• But NOT other objects

– Name– Card code– Password– Cash on hand– Date-time– Balance

Page 16: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Developing An Object Model

• Draw rectangles for objects• Add associations• Add multiplicities

• Revise for inheritance

• Consider further revision for simplification and clarity

Page 17: COP 4331 – OOD&P Lecture 9 Object-Oriented Analysis.

Use Case Diagram and Interaction Diagrams

• Develop Use Case Diagram

• Develop Example Interaction Diagram