Chap 5. OO Analysis and Design

69
1 Chap 5. OO Analysis and Design 서서서서서 서서서서서서 Internet Data Base Lab 서서 서서서 OBJECT-ORIENTATION by Khoshafian and Abnous

description

OBJECT-ORIENTATION by Khoshafian and Abnous. Chap 5. OO Analysis and Design. 서울대학교 컴퓨터공학부 Internet Data Base Lab 교수 김형주. Overall Pictures of OO SW Design. Object-Oriented Software Engineering History of Software Engineering Designing Reusable Classes - PowerPoint PPT Presentation

Transcript of Chap 5. OO Analysis and Design

Page 1: Chap 5. OO  Analysis and Design

1

Chap 5. OO Analysis and Design

서울대학교 컴퓨터공학부Internet Data Base Lab

교수 김형주

OBJECT-ORIENTATION by Khoshafian and Abnous

Page 2: Chap 5. OO  Analysis and Design

2

Overall Pictures of OO SW Design

Object-Oriented Software Engineering History of Software Engineering Designing Reusable Classes

Object-Oriented Analyasis / Design E-R Modeling / Semantic Modeling Booch method, Rambaugh OMT, Scheller-Mellor method

Unified Modeling Method (UML)

Page 3: Chap 5. OO  Analysis and Design

3

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 4: Chap 5. OO  Analysis and Design

4

1. Introduction(1)

The OO concepts are used throughout the process requirement specification ( problem definition ) analysis ( what the product in question is ) design ( how it should be built )

Page 5: Chap 5. OO  Analysis and Design

5

Introduction (2)

Object-orientedConcepts

ADT

OODesign

OODesign

Object-OrientedProgramming

Object-OrientedProgramming

OOAnalysis

Real-world Problem

Inheritance

Identity

Page 6: Chap 5. OO  Analysis and Design

6

Modeling SW Development Processes (1)

RequirementSpecification

AnalysisAnalysis

DesignDesign

CodingCoding

TestTest

ProductionProduction

Waterfall model(W. Royce, 1970)

A “traditional” software development “waterfall” process

Page 7: Chap 5. OO  Analysis and Design

7

Modeling SW Development Processes (2)

Dynamic and iterative nature of OO Development In object-oriented development, third-party

“components” or class hierarchies are integrated

Redesign an entirely new class structure, as the incrementally extended “forest” becomes unmanageable

Page 8: Chap 5. OO  Analysis and Design

8

RequirementRequirement

OODesign

OODesign

OOProgramming

OOProgramming

OOAnalysis

OOAnalysis

SC

ProposedEnhancements

NewPossibilities Performance

Issues

New Third-partyClass Hierarchies

Client/ServerComputing

New Technologies

ComponentObject Computing

Innovationsin Analysisand Design

The dynamic & iterative nature of OO development

Page 9: Chap 5. OO  Analysis and Design

9

Object-Oriented Analysis and Design

OOA(Object-Oriented Analysis) - what is used to provide a detailed description of a system

using object-oriented notation, concepts, and methodology

OOD(Object-Oriented Design) - how concentrates on providing the blueprint for

implementation

Design-before-Implementation Software Engineering

Page 10: Chap 5. OO  Analysis and Design

10

OOA/OOD Methodologies (1)

Shlaer and Mellor OOA/OOD ( Shlaer and Mellor, 1988, 1992 )

Wirfs-Brock Responsibility Driven Design ( Wirfs-Block and Wilkerson, 1989 )

Coad and Yourdon OOA/OOD ( Coad and Yourdon, 1991a, 1991b )

Object Behavior Analysis ( Rubin and Goldberg, 1992 )

Objectory method ( Jacobson et al. , 1992 )

Page 11: Chap 5. OO  Analysis and Design

11

OOA/OOD Methodologies (2) Martin and Odell OOA/OOD

( Martin and Odell, 1993 ) Fusion

( Coleman et al. , 1994 ) Booch OOA/OOD

( Booch, 1994 ) Rumbaugh Object Modeling Technique(OMT)

( Rumbaugh et al. , 1994 )

UML (Unified Modeling Language) !!!

Page 12: Chap 5. OO  Analysis and Design

12

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 13: Chap 5. OO  Analysis and Design

13

2. Inventions, Aspirations, Requirements

Requirements The system functionality (by what, for whom) The user/machine/system interaction The environment (hw/sw platform, network)

The observation: Feedback and prototyping can further enhance and clarify the system

SW development methodology should consider the above issue!

Page 14: Chap 5. OO  Analysis and Design

14

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 15: Chap 5. OO  Analysis and Design

15

3. Object-Oriented Analysis (1)

Booch’s definition of OOA A method of analysis that examines requirements from the per

spective of classes and objects found in the vocabulary of the problem domain.

What What is the application being built from the end user’s perspec

tive?

Page 16: Chap 5. OO  Analysis and Design

16

Object-Oriented Analysis (2)

Programmers must identify Entities, relationships, and operations Aspects of the behavior of entities

static( definition of classes ) dynamic( interaction between objects, state transition,

and so on )

All operations All constraints

Classification The identification of the classes that contain

objects similar to one another

Page 17: Chap 5. OO  Analysis and Design

17

Object-Oriented Analysis (3)

Major Findings of OOA

1. Objects and classes2. Object attributes3. Object and Class relationships

Inheritance Relationships One-to-One, One-to-Many, Many-to-Many

Relationships

Page 18: Chap 5. OO  Analysis and Design

18

PersonPerson

EmployeeEmployee StudentStudent

SalesPersonSalesPerson SecretarySecretary

MultimediaMultimedia

RasterRasterGraphicGraphic

ImagesImagesVideoVideoAudioAudio

< A number of inheritance relationships >

Page 19: Chap 5. OO  Analysis and Design

19

SourceCode

N/1

Relationship

WorkFlow CreatedBy Person

Policy of Department Department

Node

HasLink

Link

DestinationNode

HasNode

1

N

11

N N

1

N1

N

N

N

1/N

Entity

< Entity Relationship for a workflow schema >

Page 20: Chap 5. OO  Analysis and Design

20

Object-Oriented Analysis (4)

Major Findings of OOA 4. Operations on objects and classes

Workflow

CreatorWorkflow

NumberOfActiveWorkflows

ContainsNode (Rule)

Boolean

Person

Integer

< A number of methods associatedwith the class Workflow >

Page 21: Chap 5. OO  Analysis and Design

21

Object-Oriented Analysis (4)

Major Findings of OOA

5. Dynamic concepts State transition diagrams Data flow diagrams Timing diagrams

ImmediateState

ImmediateState

ImmediateState

ImmediateState

Event orAction

State transition

End orResult State

StartState

Page 22: Chap 5. OO  Analysis and Design

22

User

Process

Process

Process

Process

1 2

3 4

Storage 2

Storage 1

Data 1

Data 2

Data 3

Data flow

Page 23: Chap 5. OO  Analysis and Design

23

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 24: Chap 5. OO  Analysis and Design

24

4. Defining Object-Oriented Design (1)

Berard’s definition of OOD Object-oriented design is that portion of the sw lifecycle

that prepares definitions as to how the system will accomplish its requirements.

The models prepared in analysis are either refined, or transformed, into design models that depict the physical nature of the software product

Page 25: Chap 5. OO  Analysis and Design

25

Defining Object-Oriented Design (2) The goal of design

To produce the structure of detailed implementation specifications

Analysis: requirement specification Design: implementation specification

The design phase A coarse-grained design phase A more detailed design phase

Page 26: Chap 5. OO  Analysis and Design

26

Coarse-Grained Design (1)

Coarse-Grained Approach is to break the system into smaller subsystems subsystems could be supported by different OOA

and OOD methods often this approach takes the form of layered

systems & architectures with clean interfaces between the layers ( I.e., Client/Sever coarse-grained architecture )

Page 27: Chap 5. OO  Analysis and Design

27

Coarse-Grained Design (2)

The coarse-grained design phase Identification of all the subsystems or class

categories involved in the system Mapping of various categories onto different

processes and processors Identification of the third-party software modules Identification of the various add-on components

Page 28: Chap 5. OO  Analysis and Design

28

GUI & Enviroment

Workflow Alerter, In/Out-Box, etc.

Workflow Design Tool

Workflow Activation Tool

Workflow Tracking-Status

Workflow Manager Services

Workflow Interpreter

Route Manager / Rule Manager

Workflow Tracking Manager

Workflow User & Group Manager

Workflow Administrator Manager

DBMS E-Mail & Message Service

Client Site

Server Site

< Coarse-Grainedarchitecture of a Workflow system >

Page 29: Chap 5. OO  Analysis and Design

29

More Detailed Design

More Detailed Design the next phase of coarse-grained design, in the

development life cycle each class category is designed in great detail all the structures, operations, object

interactions, and dynamic concepts of the system are specified here

Page 30: Chap 5. OO  Analysis and Design

30

Design Specification (More Detailed)

Subsystems or class categories Class definition Class relationships Object diagrams and object relationships State transition Timing diagrams Designing algorithms Physical compilation units

Page 31: Chap 5. OO  Analysis and Design

31

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 32: Chap 5. OO  Analysis and Design

32

5. Semantic and E-R Modeling

DB structures and DB design ER modeling has been one of the most

successful paradigms for designing types and objects

ERs are the forerunners of more powerful semantic data models

ER model: Peter Chen, MIT, 1976

Page 33: Chap 5. OO  Analysis and Design

33

Semantic Data Modeling

Goal: to model the real world as closely as possible do not incorporate behavioral abstraction model structural abstraction

Design tools for DB Assigning semantics: Node and Link Many ideas from AI Knowledge Representation Semantic Data Models

ER(Entity-Relationship) Model (Chen, 1976) GSM(Generalized Semantic Model, (Hull and King, 1987) And many many others

Page 34: Chap 5. OO  Analysis and Design

34

A Printable Entity Type

An Abstract Entity Type

Entity Types That AreSubtypes of OtherEntity Types

Aggregation(Cartesian Product)Constructed Type

GroupingConstructed Type

Single-valued Attribute

Multivalued Attribute

IS-A Inheritance

Element ofConstructed Type

Node Typesin GSM

Link Typesin GSM

tuple

set

Page 35: Chap 5. OO  Analysis and Design

35

EmployeeSalary

lastmiddle

first

PersonAge

Age

Name

NAME

AddressPerson

Department

OfficeWorker

Department

Salary

Account

SalesPerson

Order

Orders

Accounts

Address

A GSM model for thesales office automation

Page 36: Chap 5. OO  Analysis and Design

36

Entity Relationship Modeling (1)

Entity type A set of objects(entities)

Attributes A function that can apply to an entity

Relationship Cardinality (one-to-one, many-to-one, many-to-

many)

Page 37: Chap 5. OO  Analysis and Design

37

Entity Relationship Modeling (2)

Implementation steps of RDB applications

1. Identify Entity and Relationship of problem domain (Drawing ER diagrams)2. Merge views from different perspectives3. Map an ER diagram onto a DB schema (a set of

tables)4. Physical design (Keys, Index, Replication)

Page 38: Chap 5. OO  Analysis and Design

38

WorksIn

HasAccounts

HasOrders

Account Order

SalesPerson Department

Age

SalaryName

Address Zip

State

City

StName

StNumber

LivesAt

DeptName Budget

N

N

111

N

M N

< An ER model for the sales office automation >

Page 39: Chap 5. OO  Analysis and Design

39

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 40: Chap 5. OO  Analysis and Design

40

6. Overview of Existing Methodologies

Issues for Selecting OO Methodology

1. Software Development Process2. Notations and Diagrams3. Application Domain (General vs Specific)4. Language Constructs 5. Availability of Tools

Page 41: Chap 5. OO  Analysis and Design

41

Booch’s OOA and OOD (1)

Grady Booch, 1994 Rational Rose/C++

The major steps using Booch’s method Requirement analysis (RA) Domain analysis (OOA) Design (OOD)

Page 42: Chap 5. OO  Analysis and Design

42

Booch’s OOA and OOD (2)

Requirement Analysis use-case ( Jacobson et al. , 1992 )

Domain Analysis Identification of the classes Identification of relationships Identification of object diagrams Identification of attributes and operations Identify inheritance

Page 43: Chap 5. OO  Analysis and Design

43

USE CASE What is Use Case?

Scenario between System and User Specific pattern of using System

Use Case Making new schedule Notifying important

promise Showing someone’s

public schedule

Show Calendarfor new schedule

Notify important promise

Show someone’spublic schedule

Scheduler

Use Case Diagram

Actor2

Actor1

Page 44: Chap 5. OO  Analysis and Design

44

Candidate

Manager

Text

Person

Employee

University

< Booch OOA: Identification of the classes in the problem >

Page 45: Chap 5. OO  Analysis and Design

45

Candidate

Manager

Text

Person

Employee

University

Interview

Propose

Biography

ReferencesUniversities

Attended

1

N

N

M

1

N

11

N

1

Interview

Personnel

DepartmentManager

3. Make Offer (New Candidate)

2. Linked by Most (New Candidate)1. Qualifies

(New Candidate)

1. Manager qualifies2. Most people in department approve3. An offer is made

< Class diagrams showing attributes & inheritance > < Identification of object diagrams >

Booch OOA

Page 46: Chap 5. OO  Analysis and Design

46

Candidate

Candidate

Name : StringDate of Birth : DateSocial Security : String

HighestDegree( )NumberOfYearsWorkExperience( )

Person

Employee Student

SalesPerson Graduate

CorporateHiring Process

DepartmentHiring Process

ManagerHiring Process

< Attributes & operations for class Candidates >

<Inheritance hierarchies in Booch notation>

Booch OOA

Page 47: Chap 5. OO  Analysis and Design

47

Booch’s OOA and OOD (3)

The steps of Booch’s OOD Class categories for major components of the architec

ture Detailed design Processes and devices Modules

Page 48: Chap 5. OO  Analysis and Design

48

OCRProcessingComputer

DatabaseStorageEngine

Full-TextRetrievalEngine

FAXStation

ScannerStation

StorageSubsystem

WorkflowUser Interface

WorkflowSystem

Operating SystemGraphicalInterface

WorkflowDatabaseManager

ElectronicMessaging

Class categories for a workflow system

Some of the devices and processorsin a document imaging system

Booch’s OOD

Page 49: Chap 5. OO  Analysis and Design

49

The OMT OOA and OOD

James Rumbaugh, 1991 Object-Oriented Analysis (OOA)

Problem Statement Object Model -- object diagram Dynamic Model -- event trace, state transition diagram Functional Model -- data flow diagram

Object-Oriented Design (OOD) System Design Object Design

Page 50: Chap 5. OO  Analysis and Design

50

Object Model

The definitions of Object Model the object model describes the structure of the objec

ts in a system --- their identity, relationships to other objects, and attributes.

( Rumbaugh et al. , 1991 ) Object Diagram

captures the notation for objects

Page 51: Chap 5. OO  Analysis and Design

51

List ChildrenSpouseChange Address...

OMT - Object Diagrams

Person

Name: StringDate of Birth: Date...

Person

Student Employee

SalesPerson

MarketingPerson

Class 1 Class 2

Manager Department

Employee Department

Person Address

SalaryRole

Lives-in

Works-in

Class with attributesand operations

Inheritance/generalizationhierarchies

Relationships orAssociations

Page 52: Chap 5. OO  Analysis and Design

52

OMT - Dynamic Model

Event & state Event trace scenario

objects, messages

State transition diagram events, states

Page 53: Chap 5. OO  Analysis and Design

53

Candidate SecretaryHiring

Manager

Sends Resume

Acknowledge

Forwards Resume

Instructs Setting UpInterview

Calls to Set Up Interview

RespondsSets Up Interview

Schedule

Accepts InterviewSchedule

OMT dynamic modeling: Event traceto set up interview for hiring a candidate

Page 54: Chap 5. OO  Analysis and Design

54

AnalyzeNext Potential

Trade

Search Libraryon Company

PerformTrade

PerformStock/Company

Analysis

Initiate:

Recommend

Company

LibrarySearch forCompany X

InitiateAnalysis

OMT dynamic modeling: State transition for trade transactions

Page 55: Chap 5. OO  Analysis and Design

55

OMT - Functional Model(1)

Data flow diagram Nodes in data flow diagrams

Processes Accept values, process, output

Data stores Store data

Actors Objects producing and consuming values

Page 56: Chap 5. OO  Analysis and Design

56

OMT - Functional Model (2)

FAX ImageStore

DocumentStorage

AnnotateFAX Image

PrintProcess andDigital FAXDocument

FAXMachine

Data flow diagram in OMT

fax fax

image image

annotated

Page 57: Chap 5. OO  Analysis and Design

57

Shlaer and Mellor OOA and OOD (1)

Lawrence Berkeley Lab., 1979 most applications used for the developed OOA method

were for larger industrial-strength real-time applications

OOA Partitioning into domains Objects and Information Model Lifecycles and State Transition Diagrams Object Communication Diagram Action Data Flow Diagrams

OOD

Page 58: Chap 5. OO  Analysis and Design

58

Hiring NewEmployees

RequirementTracking

InterviewProcessing

Automated HiringUser Interface

Departmentand Employees’

Approval Process

ServerArchitecture

DocumentImaging

Networking Programming

< Domain in an automated hiring process >

Shlaer & Mellor OOA: Partitioning into Domains

Page 59: Chap 5. OO  Analysis and Design

59

Shlaer and Mellor OOA and OOD (2)

Objects and Information Model Objects

Attributes Identifiers cf.) key in RDB

Object relationships One-to-one, one-to-many, many-to-many Conditional, unconditional Inheritance relationships

Page 60: Chap 5. OO  Analysis and Design

60

1. PERSON (P) * SSN * Name - Date of Birth - Nationality - Marital Status ……....

(1:1)C

(1:1c)C C

(1c:1c)

C

C

C

(1:M)(1c:M)(1:Mc)

C(1c:Mc)

(M:M)C

C C(M:Mc)

(Mc:Mc)

< “objects” & their attributes >

< Relationship links in Shlaer-Mellor >

< Inheritance hierarchies in Shlaer-Mellor >

Shlaer & Mellor OOA: Object and Information Model

Page 61: Chap 5. OO  Analysis and Design

61

Shlaer and Mellor OOA and OOD (3)

Lifecycles and State Transition Diagrams most objects in the real world go through life

cycle due to events that occur, objects can go one

stage(state) to the other

Page 62: Chap 5. OO  Analysis and Design

62

1.Waiting to Receive FAX

2.Establishing Protocol

3.Receiving FAX

4.Pringting Report

Phone RingsF1:FAX Answers Phone

Starting TransmissionF2:FAX Machine Is Receiving FAX Pages

Terminating TransmissionF3:FAX Machine Indicates Completion of Transmission

State transitionfor a FAX machinein the Shlaer-Mellor

notation

Shlaer & Mellor OOA: State transition diagram

Page 63: Chap 5. OO  Analysis and Design

63

Shlaer and Mellor OOA and OOD (4)

Object Communication Diagram (OCD) Capture the interaction between various

objects and state models for the complete system

Abstraction of the whole system

Statemodel

External Object event

Page 64: Chap 5. OO  Analysis and Design

64

Object Communication for scanning and OCR-ing images

ErrorsUser at

Scan StationOCR

SystemOCR

Zoned AreaScanImage Scan Completed

and Displayed

Start Scanning

Error Conditions

Rescan

DisplayImage

Create Text Window

Rec

og

niz

ed T

ext

Display Text Stream

ScanningSoftware

Scanner

WindowDisplaying

ImageText Window

Shlaer & Mellor OOA: Object Communication Diagram

Page 65: Chap 5. OO  Analysis and Design

65

Shlaer and Mellor OOA and OOD (5)

Action Data Flow Diagram Processes Stores Data flows Control flows

Page 66: Chap 5. OO  Analysis and Design

66

Shlaer-Mellor process model supports control as well as data flow

Process 1

Process 2 Process 3

True

False

StorageDate

Data

Process 1

Process 2

Data Control

Schlaer & Mellor OOA: Action Flow Diagrams

Page 67: Chap 5. OO  Analysis and Design

67

Shlaer and Mellor OOA and OOD (6)

OO Design in Shlaer and Mellor Architecture domain

Supporting state machines and timers A main program, the architecture classes, the application classes Class diagrams, inheritance diagrams Class structure charts

Internal structure of the code in the operations of the class Dependency diagrams

Client/Server relationships between classes OODLE(Object-Oriented Design Language)

Page 68: Chap 5. OO  Analysis and Design

68

Contents

1. Introduction2. Inventions, Aspirations, and Requirements3. Object-Oriented Analysis4. Defining Object-Oriented Design5. Semantic and ER Modeling6. Overview of Existing Methodologies Booch method Rambaugh OMT method Shlaer and Mellor method

Page 69: Chap 5. OO  Analysis and Design

69

Summary

OOA/OOD Methodologies OOA - what OOD - how Semantic data model ER - popular in DB application design Booch OOD Rambaugh OMT Shlaer-Mellor Method