• No results found

objects16.ppt

N/A
N/A
Protected

Academic year: 2020

Share "objects16.ppt"

Copied!
32
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Agenda

Announcements

Review Introduction ot Objects

Chapter 11 material – Object Modeling

15 Minute Break

(3)

Announcements

The IT Club has arranged for a guest speaker

 Informal presentation regarding Software

Industry in BiH

http://www.infostudio.ba

 Saturday November 29th at 12:00  RSVP to [email protected]  Question and Answer Session

PMI Meeting was small but productive

(4)

Review: Introduction to Objects

An object is a collection of attributes (state) and methods

that operate on those attributes (behavior).

Inheritance: objects can inherit attributes and methods

from other objects

Polymorphism: Selecting the method appropriate for the

class of object called. One construct can take many forms.

Encapsulation: the inclusion of many features in one object.

This provides data protection and abstraction. The data and methods are stored together.

Method: a feature that describes programs within an object.

(5)

Review: Introduction to Objects

Instantiation: creating an object

Class: a blueprint for an object; a generic

definition of an object

Abstract Class: a class that cannot be

instantiated

Extends: classes and objects extend other

classes and objects. This is the mechanism of inheritance.

If a class extends another class, it is a

(6)

Chapter 11

Object modeling combines processes, data, and

flows into one modeling paradigm.

This allows objects to be modeled as independent

entities and flexibly combined into systems.

The encapsulation of data and processes means that

objects can be designed independently of each other

We can specify interfaces only in order to build the

(7)

Chapter 11: UML

UML – Unified Modeling Language

UML combines aspects of ERD and DFD into

one unified model

UML provides the following types of diagrams:

 Use case diagrams

 Object class diagrams

 Sequence diagrams

 Transition diagrams

(8)

Chapter 11: Objects

Associations

 How are two objects related?

 Example: people manage projects

Composition

 Objects are made of many other kinds of objects

 Example: a project is made of many project

tasks

Inheritance

 Objects can be defined in terms of other objects

(9)

Chapter 11: Object Class Diagrams

Object Class Diagram is a diagram that

shows object classes and relationships

between them. You will also see this referred

to simply as a class diagram.

 Class Name  Properties  Methods

UML notation is commonly used for object

(10)

Chapter 11: UML Notation

PROJECTS

PROJECT-ID: string; MANAGER: string; START-DATE: date; BUDGET: real; PEOPLE-ASSIGNED(N):PERSONS; TASKS(N): PROJECT-TASKS; Add-project(project-no); Delete-project(project-no); Create-task(task-name,task-details); Change-budget(new-budget); a87: PROJECT

PROJECT-ID: a87; MANAGER: Melissa; START-DATE: 10-7-98; BUDGET: 45000.00;

PEOPLE-ASSIGNED(N):{Mary, Lin};

TASKS(N): {task20, task31}; Add-project(project-no);

Delete-project(project-no); Create-task(task-name,task-details);

Change-budget(new-budget);

(11)

Chapter 11: Object Class Diagram

PROJECT S

WORK

PERSON S

PROJECT -TASKS

MANAGER

1

1..*

0 .. *  manage 1

 work-in

1..* 1..*

Compositio n

Association Association

(12)

Chapter 11: Object Class Diagram

PROJECTS

PROJECT-NO: integer; MANAGER: PERSONS; START-DATE: date; BUDGET: 120000-00;

PEOPLE-ASSIGNED(N):PERSONS; TASKS(N): PROJECT-TASKS; Add-project(); Delete-project(); Create-task(); Change-budget(); PERSONS

SURNAME: string; DATE-OF-BIRTH: date; DATE-JOINED: date; POSITION: integer; PAY-RATE: number;

ASSIGNED-TO(N): PROJECTS; Add-person();

Delete-person(); Create-task(); Change-budget();

TASKS

TASK-NO: 4;

DATE-SET-UP: 20-6-97; DESCRIPTION: write-program;

PROGRESS: ref DOCUMENT; Update-progress();

 manage

 work-in

(13)

Chapter 11: Object Class Diagram

TASKS LOCAL-TASKS OUTSOURCE D-TASKS TASKS

TASK-NO: integer; DATE-SET-UP: date; DESCRIPTION: string; STATUS: string;

COST-TO-DATE: real; Update-progress();

LOCAL-TASKS

TASK-MANAGER: string; PERSONS(N): string; record-time-spent(); update-cost();

OUTSOURCED-TASKS

ORGANIZATION: string; CONTRACT-NO: integer; CONTRACT-RATE: integer; get-report();

update-cost();

(14)

Chapter 11: Object Modeling

Object Modeling and Analysis follows many of the

following steps prior to creating object class diagrams:

 Use cases and use case models  Sequence Diagrams

Transition DiagramsEvent Flow Diagrams  Collaboration Diagrams  Object Class Diagrams

Important: different books use different names and

(15)

Chapter 11: Use Cases

Use cases revisited

A use case describes the steps that people

follow in carrying out a system activity.

We can build a use case model from these

cases.

A use case model shows all the use cases and

the actors in each use case.

Each use case has two major components:

 Script

(16)

Chapter 11: Use Cases

The use case script is an informal description

of the steps followed in an activity.

In some development practices, use case

scripts are written on index cards.

Use case – Using the ATM

A greeting message is waiting on the ATM

The customer inserts their card into the machine The ATM asks the customer for their PIN

(17)

Chapter 11: Use Cases

Each alternative set of events is a new use

case

 What if the card is not accepted?

 What if the customer enters the incorrect PIN?  What if the withdrawal is too large?

What if the customer stops the process and

withdraws the card?

Each of these situations would require a new

(18)

Chapter 11: Use Case Model

Customer

Operator

Withdraw Cash

Transfer funds

Deposit funds

Get Report

Bank System

(19)

Chapter 11: Use Cases

Develop project

plan Produce

budget report

Produce budget

<<uses>>

<<uses>>

Classify expenditure

by task

<<extends>>

(20)

Chapter 11: Object Analysis

After we build our use case model, what next?

It is often too difficult to jump directly to

object class diagrams

If you feel that the use cases do not provide

enough information to construct quality object class diagrams then consider using:

(21)

Chapter 11: Sequence Diagram

Sequence diagram shows dynamic

relationships between objects.

They model messages exchanged between

objects in a use case.

Each object is drawn as a vertical line

Messages between objects are shown in their

time sequence from top to bottom

(22)

Chapter 11: Sequence Diagram

Customer ATM Bank System

Customer Card

Request for PIN

PIN

PIN and Card info

PIN OK w/ Accounts

Account Numbers

Selected account

(23)

Chapter 11: Transition Diagram

Another way to model use case dynamics

Each circle or ellipse represents the state of the

object

States change as the result of a message

State changes are shown with arrows labeled by

the message that caused the change of state

(24)

Chapter 11: Transition Diagram

Idle Readin g Card Waitin g for PIN Ask bank to check PIN Waiting for authorit y from bank Display accoun ts Waiting for selectio n Displa y limits Waiting for selectio n Print Receipt and give cash Receipt

Card RequestPIN PIN entered

Request security check

PIN OK w/ Accounts

Accounts Account selected

Limits

(25)

Chapter 11: Event Flow Diagram

Event Flow Diagrams bring all sequence

diagrams together into one diagram

All objects in the sequence diagrams appear

only once in the event flow diagram

All messages are shown in the event flow

diagram

The messages are grouped by direction of flowWe now have all of the information needed to

design the object class

Collaboration diagrams are similar to Event

(26)

Chapter 11: Event Flow Diagram

CUSTOMER get-PINrequest; get-accounts; get-limits; get-receipt; ATM get-card; get-PIN; get-account; get-amount; get-PINOK; get-limits; get-approval; BANK SYSTEM get-PINandCard; get-selection; get-amount; Customer inserts card Customer inserts PIN Selected account amount Request PIN Display accounts Display limits Receipt

PIN and Card information Selected account amount

(27)

Chapter 11: OOSE

These methods are part of Object-Oriented

Software Engineering

OOSE emphasize use cases

All other OOSE models depend on Use Case Model

 Domain Object Model - defines standard terms

 Analysis Model

 Design Model

 Implementation Model

 Testing Model

OOSE is well-suited to rapid application

development

(28)

Chapter 12: Object Analysis

How do we proceed with Object-oriented

analysis?

 Use a model as the foundation for defining objects

 Rich picture – pictorial representation of a system

 Start with use cases and define objects with

techniques in Chapter 11

 Use case model

 Sequence Diagrams  Transition Diagrams  Event Flow Diagrams

(29)

Chapter 12: Object Analysis

Validation and Verification

 Good Naming Conventions – Consistent across

diagrams

 Each use case and exception must have a unique

name

 Each alternative and exception must have its own

sequence diagram

 An event flow diagram must have all objects and

messages from all sequence diagrams

 An object class must have

 A method for each incoming message

(30)

Chapter 12: Object Analysis

Defining object classes

 Each object in event flow diagram becomes object

class

 Each exchange of messages becomes and association  Each parameter in a method becomes a property

Each incoming message becomes a method

Refining object classes

 Remove redundant properties

 Identify additional relationships between object classes

 Group properties

 Discover new object classes through inheritance and

(31)

Chapter 12: Object Analysis

Refining methods

 Can methods be broken down?

 Add methods to create and delete objects  Create internal methods where needed

Refactoring

 Refactoring is changing code in a way that

improves software design without changing functionality

Refactoring is a very big part of OOSERefactoring is a critical part of software

(32)

Bibliography

http://atlas.kennesaw.edu/~dbraun/csis4650/

A&D/UML_tutorial/index.htm

Excellent UML Tutorial with additional

references

http://atlas.kennesaw.edu/~dbraun/csis4650/

A&D/UML_tutorial/resources.htm

Martin Fowler, Kendall Scott: UML

References

Related documents

• Generalization can be applied at the level of single column (i.e., a generalization step generalizes all the values in the column) or single cell (i.e., for a specific column,

Dengan demikian perlakuan transplantasi pada umur 14 hari merupakan perlakuan yang lebih baik dari perlakuan lain karena jumlah ikan mas yang terkolonisasi lebih banyak

Demeter, Kore, and Eubouleus (the hierophantides and dadouchos) would have walked together in the dark from the precinct up the processional path to the Telesterion, where they

Production Items Sustainment Disposal Evolutionary Requirements Development Engineering Chang e Proposals Block Modifications Test and Evaluation Disposal Requirements

Immediately when the voter signs into the voting application, the client agent begins to gather information about the mobile phone and sends the mobile phone’s status to the

LOMA LINDA UNIVERSITY | LOMA LINDA UNIVERSITY MEDICAL CENTER | LOMA LINDA UNIVERSITY CHILDREN’S HOSPITAL | LOMA LINDA UNIVERSITY BEHAVIORAL MEDICINE CENTER | LOMA LINDA

(Changes in student population can affect program costs, revenues, and the amount of federal cash reimbursements the program will receive.) These long-term financial plans

1/. Which of the follo#ing statements are true regarding golgi a$$aratus 1/. Which one of the follo#ing organelles is located near the Which one of the follo#ing organelles is