chapter 22 object-oriented design

37
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001 Chapter 22 Chapter 22 Object-Oriented Object-Oriented Design Design

Upload: jacqui

Post on 22-Feb-2016

49 views

Category:

Documents


0 download

DESCRIPTION

Chapter 22 Object-Oriented Design. Object-Oriented Design. OOA and OOD. c. l. a. s. s. e. s. c. l. a. s. s. e. s. o. b. j. e. c. t. s. o. b. j. e. c. t. s. a. t. t. r. i. b. u. t. e. s. a. t. t. r. i. b. u. t. e. s. d. a. t. a. s. t. r. u. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 22 Object-Oriented Design

1These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Chapter 22Chapter 22Object-Oriented Object-Oriented

DesignDesign

Page 2: Chapter 22 Object-Oriented Design

2These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented Object-Oriented DesignDesign

responsibilitiesdesign

messagedesign

class and objectdesign

subsystemdesign

Page 3: Chapter 22 Object-Oriented Design

3These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

OOA and OOA and OODOOD

Object-relationship

model

Object-BehaviorModel

CRCIndex Cards

Attributes, operations,collaborators

THE ANALYSIS MODEL

responsibilitiesdesign

messagedesign

Class and objectdesign

subsystemdesign

THE DESIGN MODEL

Use cases

Page 4: Chapter 22 Object-Oriented Design

4These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

OOA and OOA and OODOOD

classesclassesattributesattributesmethodsmethodsrelationshipsrelationshipsbehaviorbehavior

Analysis ModelAnalysis Model

objectsobjectsdata structuresdata structuresalgorithmsalgorithmsmessagingmessagingcontrolcontrol

Design ModelDesign Model

(design classes)

Page 5: Chapter 22 Object-Oriented Design

5These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Design Design IssuesIssues decomposability—facility where a design method helps decomposability—facility where a design method helps

designer to decompose a large problem to solve;designer to decompose a large problem to solve; composability—degree to which a design method ensures composability—degree to which a design method ensures

that program components (modules), once designed and that program components (modules), once designed and built, can be reused ;built, can be reused ;

understandability—ease with which a program component understandability—ease with which a program component can be understood without reference to other information can be understood without reference to other information or other modules;or other modules;

continuity—ability to make small changes in a program continuity—ability to make small changes in a program and have these changes manifest themselves with and have these changes manifest themselves with corresponding changes in just one or a very few modules;corresponding changes in just one or a very few modules;

protection— architectural characteristic reducing the protection— architectural characteristic reducing the propagation of side affects if errors occur in a module.propagation of side affects if errors occur in a module.

Page 6: Chapter 22 Object-Oriented Design

6These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Generic Components for Generic Components for OODOOD

Problem domain component—the subsystems that Problem domain component—the subsystems that are responsible for implementing customer are responsible for implementing customer requirements directly;requirements directly;

Human interaction component —the subsystems Human interaction component —the subsystems that implement the user interface (this included that implement the user interface (this included reusable GUI subsystems);reusable GUI subsystems);

Task Management Component—the subsystems Task Management Component—the subsystems that are responsible for controlling and that are responsible for controlling and coordinating concurrent tasks that may be coordinating concurrent tasks that may be packaged within a subsystem or among different packaged within a subsystem or among different subsystems;subsystems;

Data management component—the subsystem that Data management component—the subsystem that is responsible for the storage and retrieval of is responsible for the storage and retrieval of objects.objects.

Page 7: Chapter 22 Object-Oriented Design

7These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Process Flow for Process Flow for OODOOD

Page 8: Chapter 22 Object-Oriented Design

8These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

System Design System Design ProcessProcess• • Partition the analysis model into subsystems.Partition the analysis model into subsystems.

• • Identify concurrency that is dictated by the problem.Identify concurrency that is dictated by the problem.• • Allocate subsystems to processors and tasks.Allocate subsystems to processors and tasks.• • Develop a design for the user interface.Develop a design for the user interface.• • Choose a basic strategy for implementing data Choose a basic strategy for implementing data management.management.• • Identify global resources and the control mechanisms Identify global resources and the control mechanisms required to access them.required to access them.• • Design an appropriate control mechanism for the Design an appropriate control mechanism for the system, including task management.system, including task management.• • Consider how boundary conditions should be handled.Consider how boundary conditions should be handled.• • Review and consider trade-offs.Review and consider trade-offs.

Page 9: Chapter 22 Object-Oriented Design

9These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

System System DesignDesign

requestclientsubsystem

contract

contract contract

request

request

serversubsystem

peersubsystem

peersubsystem

Page 10: Chapter 22 Object-Oriented Design

10These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Subsystem Subsystem ExampleExample

assign to zonetest status

request for alarm notificationperiodic check-inrequire for configuration update

request for statusControlpanel

subsystem

Sensorsubsystem

Centralcommunication

subsystem

request for system statusspecification of type of alarm

periodic status check

Page 11: Chapter 22 Object-Oriented Design

11These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Subsystem Collaboration Subsystem Collaboration TableTable

Page 12: Chapter 22 Object-Oriented Design

12These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object Object DesignDesign

A A protocol descriptionprotocol description establishes the establishes the interface of an object by defining each interface of an object by defining each message that the object can receive and the message that the object can receive and the related operation that the object performs related operation that the object performs

An An implementation descriptionimplementation description shows shows implementation details for each operation implementation details for each operation implied by a message that is passed to an implied by a message that is passed to an object. object.

information about the object's private partinformation about the object's private part internal details about the data structures that describe internal details about the data structures that describe

the object’s attributesthe object’s attributes procedural details that describe operationsprocedural details that describe operations

Page 13: Chapter 22 Object-Oriented Design

13These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented Object-Oriented DesignDesign

You text gave a very detailed description You text gave a very detailed description of structured design and how you can of structured design and how you can take a data flow diagram and migrate it take a data flow diagram and migrate it to a program structure chart. . to a program structure chart. .

Remember we censored that material. Remember we censored that material. You text does not afford OO design that You text does not afford OO design that

same detailed description.same detailed description. I will attempt to augment the text HERE.I will attempt to augment the text HERE.

Page 14: Chapter 22 Object-Oriented Design

14These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented Object-Oriented DesignDesign

WHAT WE HAVE – from the SRSWHAT WE HAVE – from the SRS 1. Use Case Diagrams1. Use Case Diagrams 2. Process Diagrams for each major 2. Process Diagrams for each major

application process or applet (in our application process or applet (in our case just one)case just one)

3. Class Diagrams showing the major 3. Class Diagrams showing the major classes of the system.classes of the system.

4. State Transaction diagrams for 4. State Transaction diagrams for each class. each class.

Page 15: Chapter 22 Object-Oriented Design

15These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented Object-Oriented DesignDesign

WHAT WE NEED – for the SDSWHAT WE NEED – for the SDS

1.General Architecture for the Design of the 1.General Architecture for the Design of the System including sub-systems, client server System including sub-systems, client server interfaces, and their related communications and interfaces, and their related communications and allocations.allocations.

2. Design Class Diagrams showing the major 2. Design Class Diagrams showing the major classes of the system from a design perspective. classes of the system from a design perspective.

3. Use Case Diagrams denoting 3. Use Case Diagrams denoting applets/applications with their supporting applets/applications with their supporting sequence diagrams.sequence diagrams.

Page 16: Chapter 22 Object-Oriented Design

16These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented High-Level Object-Oriented High-Level DesignDesign

High Level System Environmental High Level System Environmental DesignDesign Level of Client/ServerLevel of Client/Server What type machines at each levelWhat type machines at each level Database software needed at each levelDatabase software needed at each level Communications software needed at each Communications software needed at each

levellevel Communications hardware needed at each Communications hardware needed at each

levellevel User Interface software proposedUser Interface software proposed Any needed middlewareAny needed middleware

Page 17: Chapter 22 Object-Oriented Design

17These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented High-Level Object-Oriented High-Level DesignDesign Client Client Server Server DB DB

ServerServer Environment EnvironmentEnvironment Environment

EnvironmentEnvironment

Compaq PCNTVisual Basic …..

Compaq ServerNTVisual BasicMSMQSNA Server (COMTI)

Mainframe IBMXXXMVSCICSCobol Programs

Access SQL - 7 IMSCrystalReports

Hand ReadersCamerasVB Screens

Page 18: Chapter 22 Object-Oriented Design

18These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented High-Level Object-Oriented High-Level DesignDesign Client Client Server Server DB DB

ServerServer Environment EnvironmentEnvironment Environment

EnvironmentEnvironment

Compaq PCNTVisual Basic …..

Compaq ServerNTVisual BasicMSMQSNA Server (COMTI)

Mainframe IBMXXXMVSCICSCobol Programs

Access SQL - 7 IMSCrystalReports

Hand ReadersCamerasVB Screens

TCPIPMSMQ Messages

T1/transactionsTwisted Pair

SNA Server(COMTI)TCPIP

CICS TransT1 Line

Page 19: Chapter 22 Object-Oriented Design

19These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented Object-Oriented DesignDesign

Once the High Level System Once the High Level System Environmental Environmental Design is complete Design is complete

You must:You must: Define the classes needed at each levelDefine the classes needed at each level Define the use cases needed at each level. Define the use cases needed at each level.

This requires an iterative processThis requires an iterative process

Page 20: Chapter 22 Object-Oriented Design

20These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Object-Oriented High-Level Object-Oriented High-Level DesignDesign Client Client Server Server DB DB

ServerServer Environment EnvironmentEnvironment Environment

EnvironmentEnvironment

Page 21: Chapter 22 Object-Oriented Design

21These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System

attributes

methods

ClassName

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

Customer

CID: int

name: String

authenticateCustomer ()

relationship

rents

1..*1..*

Multiplicity

Page 22: Chapter 22 Object-Oriented Design

22These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Design Class Design Class DiagramsDiagrams

Domain classes (denoted in the analysis Domain classes (denoted in the analysis phase and reported on our SRS)phase and reported on our SRS)

Interface classes for all external interfacesInterface classes for all external interfaces Database/file classes for all persistent dataDatabase/file classes for all persistent data Concurrency classes for controlling Concurrency classes for controlling

concurrencyconcurrency Analysis PatternsAnalysis Patterns Application PatternsApplication Patterns Design PatternDesign Pattern

Page 23: Chapter 22 Object-Oriented Design

23These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System – domain classes

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

CustomerCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

DistributordistributorID: String

Distributor Name: String

…….

trackOrder()

Page 24: Chapter 22 Object-Oriented Design

24These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System – analysis patterns

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

CustomerCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

DistributordistributorID: String

Distributor Name: String

…….

trackOrder()

Party

…….

Page 25: Chapter 22 Object-Oriented Design

25These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System + interface classes

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)CID: int

name: String

authenticateCustomer ()

Movie View(s)CID: int

name: String

authenticateCustomer ()

Rental View (s)CID: int

name: String

authenticateCustomer ()

Page 26: Chapter 22 Object-Oriented Design

26These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System + database classes

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database Class

Page 27: Chapter 22 Object-Oriented Design

27These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Use Case Diagrams

Video Rental System

Enroll Customer

Customer

Return video

CorporateOrder new videos Use Case

Actor

System

Rent video

Page 28: Chapter 22 Object-Oriented Design

28These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + use case classes

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database ClassRent Video

Enroll Customer Return Video

Page 29: Chapter 22 Object-Oriented Design

29These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + use case views

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database ClassRent Video

Enroll Customer Return Video

Use case views

Rent Video View

Page 30: Chapter 22 Object-Oriented Design

30These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + application patterns

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database ClassRent Video

Enroll Customer Return Video

Party CtrlMovie Ctrl

Rental Ctrl

Rent Video View

Rent Video Ctrl

Page 31: Chapter 22 Object-Oriented Design

31These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + application patterns

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database ClassRent Video

Enroll Customer Return Video

Party CtrlMovie Ctrl

Rental Ctrl

Rent Video View

Rent Video Ctrl

Page 32: Chapter 22 Object-Oriented Design

32These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + application patterns

Cassette

cassetteID: int

cassetteVolumeNo: int

rentMovie()

PartyCID: int

name: String

authenticateCustomer ()

RentalcassetteID: int

customerID: int

dateRented: date

rentMovie()

Movie

movieID: int

movieName: String

orderMovie()

Party View(s)

Movie View(s)

Rental View (s)

Movie Table

Cassette TableRental TableParty Table

Database Class

Rent VideoEnroll Customer Return Video

Party CtrlMovie Ctrl

Rental Ctrl

Rental Report

Rent Video View

Rent Video Ctrl

Page 33: Chapter 22 Object-Oriented Design

33These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System + design patterns

Rent video

read trans

produce error msg

validate trans

determine type

SetProce

CalculateRental fee

format output

Setprice

calculate Rentalfee

format output

rental

invalid rental

error msg

Types:ChildrenCurrentClassic…..

……

Page 34: Chapter 22 Object-Oriented Design

34These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System + design patterns

Current Movie

Movie

movieID: int

movieName: String

orderMovie()

Classic MovieChildren Movie

Rent video

Page 35: Chapter 22 Object-Oriented Design

35These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class Diagrams

Video Rental System + design patterns

Current Movie

Movie

movieID: int

movieName: String

orderMovie()

Classic MovieChildren Movie

Rent videoRent Video

MovieFactoryIF

MovieFactory

Factory

Page 36: Chapter 22 Object-Oriented Design

36These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Class DiagramsVideo Rental System + design patterns

CurrentLine

Linee

ClassicLineeChildrenLine

Rent videoRent Video

MovieFactoryIF

MovieFactory

Rental ReportReport IF

Report Builder

Builder

Page 37: Chapter 22 Object-Oriented Design

37These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001

Use Case Diagrams

Video Rental System

Enroll Customer

Customer

Return video

CorporateOrder new videos Use Case

Actor

System

Rent video