20
CH 5 PRESENTATION ORGANIZING AN OBJECT MODEL David Morales

Ch 5 Presentation

Embed Size (px)

Citation preview

Page 1: Ch 5 Presentation

CH 5 PRESENTATION

ORGANIZING AN OBJECT

MODEL

David Morales

Page 2: Ch 5 Presentation

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

Page 3: Ch 5 Presentation

Steps for Creating an Object Model

Tasks in order

1. Identify and define objects

2. Define Relationships between objects

3. Create a Relationship diagram

4. Indentify the actors and use cases

5. Create a Use Case Diagram

Page 4: Ch 5 Presentation

Steps for Creating an Object Model

Tasks in order (continued)

6. Identify cardinality and UML Notation

7. Create a Class Diagram

8. Create a Sequence Diagram

9. Create a Sate Transition Diagram

10. Create an Activity Diagram

Page 5: Ch 5 Presentation

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

Page 6: Ch 5 Presentation

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

Page 7: Ch 5 Presentation

Identify and Define Objects

Objects and methods are represented visually

AttributesEmployee numberEmployee nameAddressTelephone numberDate of birthSexTitle, rate of payDeductionsState

MethodsAdd newChange nameChange addressChange TelephoneChange deductionsChange state

EMPLOYEE

Characteristics that describe the EMPLOYEE object

Tasks that the EMPLOYEE object can perform

Message: ADD NEWTells the EMPLOYEE class to perform all the steps needed to add an EMPLOYEE

Method:ADD EMPLOYEE

Steps:1. Add new student instance2. Record employee number3. Record employee name4. Record address5. Record telephone number6. Record date of birth7. Record sex8. Record title, rate of pay9. Record deductions10. Record state11. Save new employee data

Object Metho

d

Page 8: Ch 5 Presentation

Identify and Define Objects

Each object can have different instances

There are many employees, each employee has

his/her own record

AttributesEmployee numberEmployee nameAddressTelephone numberDate of birthSexTitle, rate of payDeductionsState

MethodsAdd newChange nameChange addressChange TelephoneChange deductionsChange state

EMPLOYEE

Characteristics that describe the EMPLOYEE object

Tasks that the EMPLOYEE object can perform

Instances of EMPLOYEE

Object 0392David Morales9408 Worman Dr, Stafford555-555-555529Mar1983MaleHelp Desk Tech, 35k0VA

0023Melissa Barnes1020 Fleet St, Stafford555-555-125403Aug1971FemaleAccounting Manager, 75k3VA

Page 9: Ch 5 Presentation

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

Page 10: Ch 5 Presentation

Define Relationships between

Objects

Objects belong to classes, classes belong to

superclasses, and classes can have sub-

classes

AttributesNameDate of birth

MethodsBreathEatSleep

PERSON

AttributesEmployee numberAddressTelephone numberTitle, rate of payDeductionsState

MethodsAdd newChange nameChange addressChange TelephoneChange deductionsChange state

EMPLOYEE

AttributesMANAGER

Superclas

sSub-class

Class

Belong

s to

Belong

s to

Sub-class

name

Superclas

s name

Common

attributes

Common

methods

Class

name

Uncomm

on

attributes

Uncomm

on

methods

Uncomm

on

attributes

Uncomm

on

methods

Page 11: Ch 5 Presentation

Create Object Relationship

Diagram

Provides a visual overview of the system and

the relationships between the various objects

within

Below is a partial diagram

EMPLOYEE

DIRECTOR

OFFICE STAFF

MANAGER

Is a

Supervis

es

Supervis

es

Page 12: Ch 5 Presentation

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

Generate

Paycheck

Issues

Employee

Page 13: Ch 5 Presentation

Use Case Diagram

Visual summary of several related use cases

Generate

Paycheck

Issues

Employee

Create

Timesheet

Entry

Calculate

payrollPayroll clerck

Department head

Initiates

Notifies

Initiates

Notifies

Page 14: Ch 5 Presentation

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

Page 15: Ch 5 Presentation

Identify Cardinality – UML

Notation

How cardinality is noted with UML

UML

Notatio

n

Nature of

the

Relationshi

p

Example Description

0..* Zero or

many

Employee Payroll deduction An employee can have

no payroll deductions

or many deductions

0..1 Zero or One Employee Spouse An employee can have

no spouse or one

spouse

1 One and

only one

Office Manager Sales office An office manager

manages one and only

one sales office

1..* One or

many

Order Item Ordered One order can include

one or many items

ordered

1

1

1

1

0..*

0..1

1

1..*

Page 16: Ch 5 Presentation

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 classesHR

TRANSACTION

Attributes

Methods

HR

TRANSACTION

Attributes

Methods

HR

TRANSACTION

Attributes

Methods

HR

TRANSACTION

Attributes

Methods

HR

TRANSACTION

Attributes

Methods

Submits

Manages

Maintained for

NotifiesBased on

1

1

0..*

1..*1..*

0..*

0..*

1

1

1

Page 17: Ch 5 Presentation

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

Page 18: Ch 5 Presentation

Sequence Diagram

Sequence diagram for CHANGE

CONTRIBUTIONS function

EMPLOYEE STOCK TRANSFER

PAYROLLACTION

Change

Contributions

Change

Contributions

Page 19: Ch 5 Presentation

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

hireMeets

Requirements Gets fired

Quits

Page 20: Ch 5 Presentation

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

En

d

Change stock purchase deduction

Start

Change employee deduction

Employee changes

contributions