Object Oriented Design
Fundamentals of Computer Science
zombie[0] zombie[2] zombie[5] zombie[1] zombie[3] zombie[4]
Object Oriented Design Theres more? zombie[3] zombie[1] zombie[4] - - PowerPoint PPT Presentation
Object Oriented Design Theres more? zombie[3] zombie[1] zombie[4] zombie[5] zombie[2] zombie[0] Fundamentals of Computer Science Outline Object Oriented Design Identify the Classes Identify what Information each Class
Fundamentals of Computer Science
zombie[0] zombie[2] zombie[5] zombie[1] zombie[3] zombie[4]
Identify the Classes Identify what Information each Class Needs Identify what each Class Needs to Do
3
Customers can open accounts. They can make deposits and
All employees can help customers with deposits and
4
Person
Employee
Customer +Assign Acct Number()
Account
Product
Transaction
Deposit
Withdrawal
1
*
Interest
Fee
1
*
1
*
1
*
Attributes/State Methods/Behavior Class Name Inheritance (is-a) Composition (has-a)
Try to have each piece of data in only one place
These might indicate the attribute should be in a different class e.g. Under Customer, we have “Account Length (Time)” and
Since they both reference account, they should probably be in
Does it really applies to that class
Person
Employee
Customer +Assign Acct Number()
Account
Product
Transaction
1
*
Interest
Fee
1
*
1
*
1
*
Removed account data Made interest and fees part of product Removed deposit and withdrawal
Customers can open accounts. They can make deposits and
All employees can help customers with deposits and
9
+Create() +Read() +Update() +Delete()
Person
Employee +Assign Customer ID()
Customer +Assign Acct Number() +Create() +Read() +Update() +Delete()
Account +Create() +Read() +Update() +Delete()
Product +Create() +Read() +Update() +Delete()
Transaction
1
*
Interest
Fee
1
*
1
*
1
*
Walk through typical uses of your software and make sure the
Write an API for the interface to each of your classes For each method, define:
Name Input Parameters Return Values
Might mean splitting a single attribute into several
Identify the classes Identify what information each class needs Identify what each class needs to do Identify use cases Define the API Define the instance variables Finally – write some code!