2. How to Organize an Object Model Complete each task in the proper order Include proper amount of detail in each step Revise and edit Ensure data is correct and all necessary info is included Add additional information where needed Ensure all subsequent steps reflect update Example: if an additional class is needed, then all following steps need to show the new class
3. Steps for Creating an Object Model Tasks in order Identify and define objects Define Relationships between objects Create a Relationship diagram Indentify the actors and use cases Create a Use Case Diagram
4. Steps for Creating an Object Model Tasks in order (continued) Identify cardinality and UML Notation Create a Class Diagram Create a Sequence Diagram Create a Sate Transition Diagram Create an Activity Diagram
5. Steps for Creating an Object Model All tasks are sequential Each step depends on data generated from previous steps Additional information can be added to a previous task regardless of what step of the process you are on Updates must be reflected in all the tasks that follow the task that was updated
6. Identify and Define Objects Objects represent a real person, place, event, or transaction Each object contains attributes, methods, and messages Attributes describe the class Methods are tasks and functions the object can perform when it receives a message A message is a command
7. Identify and Define Objects Steps: 1. Add new student instance 2. Record employee number 3. Record employee name 4. Record address 5. Record telephone number 6. Record date of birth 7. Record sex 8. Record title, rate of pay 9. Record deductions 10. Record state 11. Save new employee data Method: ADD EMPLOYEE EMPLOYEE Attributes Employee number Employee name Address Telephone number Date of birth Sex Title, rate of pay Deductions State Methods Add new Change name Change address Change Telephone Change deductions Change state Characteristics that describe the EMPLOYEE object Tasks that the EMPLOYEE object can perform Objects and methods are represented visually Object Method Message: ADD NEW Tells the EMPLOYEE class to perform all the steps needed to add an EMPLOYEE
8. Identify and Define Objects EMPLOYEE Attributes Employee number Employee name Address Telephone number Date of birth Sex Title, rate of pay Deductions State Methods Add new Change name Change address Change Telephone Change deductions Change state Characteristics that describe the EMPLOYEE object Tasks that the EMPLOYEE object can perform Each object can have different instances There are many employees, each employee has his/her own record Instances of EMPLOYEE Object 0392 David Morales 9408 Worman Dr, Stafford 555-555-5555 29Mar1983 Male Help Desk Tech, 35k 0 VA 0023 Melissa Barnes 1020 Fleet St, Stafford 555-555-1254 03Aug1971 Female Accounting Manager, 75k 3 VA
9. Define Relationships between Objects Relationships enable objects to communicate and interact as the perform functions and transactions They describe What objects need to know about each other How they respond to changes in other objects The effects of member ship in classes, superclasses and sub-classes
10. Define Relationships between Objects EMPLOYEE Attributes Employee number Address Telephone number Title, rate of pay Deductions State PERSON MANAGER Attributes Name Date of birth Attributes Methods Add new Change name Change address Change Telephone Change deductions Change state Methods Breath Eat Sleep Objects belong to classes, classes belong to superclasses, and classes can have sub-classes Class Class name Superclass Superclass name Uncommon attributes Sub-class Common attributes Sub-class name Belongs to Uncommon attributes Belongs to Common methods Uncommon methods Uncommon methods
11. Create Object Relationship Diagram EMPLOYEE DIRECTOR OFFICE STAFF MANAGER Provides a visual overview of the system and the relationships between the various objects within Below is a partial diagram Is a Supervises Supervises
12. Identify the Actors and Use Case An actor is an external entity An actor initiates a use case by requesting information A use case represents the steps in a specific business function or process Issues Generate Paycheck Employee
13. Use Case Diagram Visual summary of several related use cases Initiates Create Timesheet Entry Notifies Department head Issues Notifies Generate Paycheck Initiates Calculate payroll Employee Payroll clerck
14. Identify cardinality Cardinality describes how instances of one class relate to instances of another class Example: An employee can have no payroll deductions or many payroll deductions, thus it would be a zero or many relationship Example: An employee may have one spouse or no spouse, thus it would be a zero to one relationship
15. Identify Cardinality – UML Notation How cardinality is noted with UML 1 0..* 1 0..1 1 1 1 1..*
16. Class Diagram Represents a detailed view of a single use case Shows the classes the participate in the use case Documents the relationships among the classes Maintained for 1 0..* 1 Manages 0..* Notifies 1 0..* Submits Based on 1 1..* 1..* 1
17. Sequence Diagram Dynamic model of a use case Shows the interaction among classes during a specified time period Graphically documents the use case by showing the classes, messages and the timing of messages
18. Sequence Diagram EMPLOYEE STOCK TRANSFER PAYROLLACTION Sequence diagram for CHANGE CONTRIBUTIONS function Change Contributions Change Contributions
19. State Transition Diagram Shows how an object changes from one state to another Depends on events that affect the object All possible states must be shown in the diagram Example for EMPLOYEE object Future Current Past Retires Prospective hire Quits Meets Requirements Gets fired
20. Activity Diagram Resembles a horizontal flow chart Show the actions and events as the occur Show the order in which actions take place and identify outcomes Activity diagram for CHANCE CONTRIBUTIONS scenario Change stock purchase deduction Change employee deduction Employee changes contributions Start End