UML教材2Car Case Design.docx

上传人:b****5 文档编号:11755869 上传时间:2023-03-31 格式:DOCX 页数:30 大小:1.23MB
下载 相关 举报
UML教材2Car Case Design.docx_第1页
第1页 / 共30页
UML教材2Car Case Design.docx_第2页
第2页 / 共30页
UML教材2Car Case Design.docx_第3页
第3页 / 共30页
UML教材2Car Case Design.docx_第4页
第4页 / 共30页
UML教材2Car Case Design.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

UML教材2Car Case Design.docx

《UML教材2Car Case Design.docx》由会员分享,可在线阅读,更多相关《UML教材2Car Case Design.docx(30页珍藏版)》请在冰豆网上搜索。

UML教材2Car Case Design.docx

UML教材2CarCaseDesign

APACHERENTACARCASE–DESIGN

ThissectioncontainsthedesignmodelsfortheApacheRentACarcase.Themodelsappearinchaptersequence.

ApacheRentACar–Chapter7

Introduction

Thischapterdiscussesthedesignoftheoverallsystemstructure.Thequestionsillustratehowto:

1.AllocateEssentialUseCasestoProcessors

2.AllocateStoredDatatoStorageDevices

Notethatthesestepsarenotpartofthesevenstepsforprogramdesign.

ApacheRentACarAssignments–Chapter7

1.DefinethreealternativesystemstructuresfortheApacheRentACarsystem.(SeeFigures7.13,7.14,and7.15fortheuniversityregistrationsystem.)

Alternative“A”allocatestheusecasestotwoprocessors.

Alternative“B”allocatestheusecasestoasingleprocessor,butaddsasecondprocessorforthedatastorage.

Alternative“C”sameasAlternative“A”butalsoallocatesthedatastoragetoaseparateprocessor.

2.Discussqualitativelytheadvantagesanddisadvantagesofeachalternative.

a.Alternative“A”allocatestheusecasestwoprocessors

∙Advantage:

Thiskeepsthecarmaintenancesystemusedbyemployeesseparatefromthereservationandrentalsystemusedbythecustomers.

∙Disadvantage:

Thetwoprocessorswillhavetocommunicatefrequentlywitheachother.

b.Alternative“B”allocatestheusecasestosameprocessor,butaddsasecondprocessorforthedatastorage.

∙Advantage:

Thiswillensurethatthedataissecure.Itwillbeeasiertobackupandmaintainaswell.

∙Disadvantage:

Thetwoprocessorswillhavetocommunicatefrequentlywitheachother.

c.Alternative“C”sameasAlternative“A”butallocatesalldatastoragetoaseparatestorageprocessor.

∙Advantage:

Thisallowstheprocessorstobesinglefunctionandthuscanbeoptimized.Italsomakesiteasytobackupthedatastorage,asitisseparate.

∙Disadvantage:

Thethreeprocessorswillhavetocommunicatefrequentlywitheachother.

ApacheRentACar–Chapter8

Introduction

Thischapterdiscussesthefirststepoftheseven-stepprocessforobject-orientedprogramdesign.Thisstepis:

Step1.Produceaninteractiondiagramforeachsystemoperationidentifiedduringanalysis

ApacheRentACarAssignments–Chapter8

ApacheRentACarInteractionDiagram

Thetextbookshowsalltheintermediatestepsnecessarytoobtainacollaborationdiagram.Attheendofthechapter,theyareconvertedtoasequencediagram.Oncetheindividualeventshavebeenconvertedtoacollaborationdiagram,itiscommontoconvertthemtoasequencediagram.Manypeoplefeelitiseasiertoreadsequencediagramsbecauseoftheirsequentialnature.Theanswerstothesequestionsarepresentedinthisformat.Alsoallsystemoperationsforeachusecasearegroupedtogetherinasinglesequencediagraminthesystem.

Developaseparatesetofinteractiondiagrams(eithercollaborationorsequencediagrams)foreachoftheusecasesintheRentACarsystem.

BesurethattheinteractiondiagramforeachusecasedemonstrateshowyouverifythepreconditionsandsatisfythepostconditionsforeachofthesystemoperationcontractspreparedfortheChapter5assignments.Showanexplicitcreateoperationforeachnewobject.Alsoshowanexplicitassociateoperationforeachnewlyestablishedlink.Alsobesurethateachobjectknowsalltheargumentsforanymessagethatitsends.

Suggestion:

SketchtheinteractiondiagramsfollowingthemethoddescribedinChapter8beforeyouuseanysoftwaretooltopreparethediagrams.

ApacheRentACar–Chapter9

Introduction

Thischapterdiscussessteps2and3oftheseven-stepprocessforobject-orientedprogramdesign.Thesestepsare:

Step2.Produceadesignclassdiagramshowingtheoperationsfromtheinteractiondiagrams.

Step3.Specifythesignatureandthealgorithmforeachoperation.

ApacheRentACarAssignments–Chapter9

ApacheRentACarClassDiagram

Chapter9showsthedevelopmentoftheclassdiagramwithaspecialemphasisonqualifiedassociations.

1.DevelopadesignclassdiagramfortheApacheRentACarsystem.

Payparticularattentiontoappropriateuseoftheaggregationandcompositionsymbols,whichareusedwhenanassociationbetweenclassesrelatespartstowholes,memberstogroups,orcontentstocontainers.Showclasshierarchies.Alsobesuretoindicateonthediagramnavigabilityfromoneclasstoanother.

2.ReviseandrefinetheinteractiondiagramsdevelopedfortheChapter8assignment.CorrectanyviolationsoftheLawofDemeter,reducethecoupling,andincreasethecohesion.Modifythedesignclassdiagramtobeconsistentwiththeseimprovements.

Wetookgreatcaretobesurenoneoftheseviolationswerepresentedearlier.Moststudentsunderstandcouplingandcohesion.TheLawofDemeterisprobablythemostdifficultonetoavoid.NotethatoperationslikemakeReturn,makeDriver,makeExtraCharge,andmakePaymentoccurinCarandRental.Thisispreferabletohavingthefaçadeobjectinvokeagetoperationineachoftheaboveclassestoobtaintherentalobjectandthensendamessagetoit.Thishabitiscommonamongbeginners,especiallyinprogrammingclasses.

ApacheRentACarSignatures

Althoughnotaskedfor,signaturesforalloperationswillbeprovided.Thismakesitpossiblefortheinstructortoeasilyaddanassignmenttodevelopthem.

3.Developsignaturesforalloperations.Youmayomitthe“creates”becausetheyareofastandardformat.(optionalquestion)

ThisanswerisprovidedwithsignaturesinaUMLformatasinFigure9.22.ThedatatypesarecompatiblewithJava.

CompleteSpecificationofAttributesandOperations–ApacheRentACar

Car

Attributes

-color:

String

-licenseNumber:

String

-make:

String

-model:

String

-modelYear:

int

Operations

+associateExtraChargeSpecification

(extraChargeSpecification,ExtraChargeSpecification)

+associateRental(rental:

Rental)

+associateInspection(inspection:

Inspection)

+associateThirdPartyPayer(thirdPartyPayer,ThirdPartyPayer)

+authorize(amount:

double,merchantNumber:

int):

boolean

+makeCreditCard(creditCardNumber:

String,

expirationMonth:

int,expirationYear:

int)

+makeDriver(name:

String,birthDate:

Date,

driversLicenseNumber:

String,stateOfIssue:

String)

+makeExtraCharge(amountCharged:

double)

+makeInspection(damage:

double,gasLevel:

double,mileageIn:

int,

time:

Date)

+makePayment(amount:

double)

+makeRental(timeOut:

Date,mileageOut:

int)

+makeReturn(timeIn:

Date)

CreditCard

Attributes

-creditCardNumber:

String

-expirationMonth:

int

-expirationYear:

int

Operations

+authorize(amount:

double,merchantNumber:

int):

int

Customer

Attributes

-address:

String

-name:

String

-phoneNumber:

String

Operations

None

CompleteSpecificationofAttributesandOperations–ApacheRentACar(Continued)

Driver

Attributes

-birthDate:

Date

-driversLicenseNumber:

String

-name:

String

-stateOfIssue:

String

Operations

None

ExtraCharge

Attributes

-amountCharged:

double

Operations

+associateExtraChargeSpecification

(extraChargeSpecification,ExtraChargeSpecification)

ExtraChargeSpecification

Attributes

-extraChargeCode:

String

-description:

String

-price:

double

Operations

None

Inspection

Attributes

-damage:

double

-gasLevel:

double

-mileageIn:

int

-time:

Date

Operations

None

Payment

Attributes

-amount:

double

-authorizationNumber:

int

-date:

Date

Operations

+associateCreditCard(creditCard:

CreditCard)

+authorize(amount:

double,

merchantNumber:

int):

boolean

+makeCreditCard(creditCardNumber:

String,

expirationMonth:

int,expirationYear:

int)

RentalSystem

Attributes

None

Operations

+assignCar()

+enterCarRequest(carType:

String,pickUpDate:

Date,

returnDate:

Date)

+enterConfirmation(confirmationNumber:

int,timeOut:

Date)

+enterCreditCard(creditCardNumber:

String,

expirationMonth:

int,expirationYear:

int)

+enterCustomer(phoneNumber:

String,name:

String,address:

String)

+enterDriver(name:

String,birthDate:

Date,

driversLicenseNumber:

String,stateOfIssue:

String)

+enterExtraCharge(extraChargeCode:

String,amountCharged:

double)

+enterInspection(licenseNumber:

String,damage:

double,

gasLevel:

double,mileageIn:

int)

+enterMileageOut(mileageOut:

int)

+enterReturn(licenseNumber:

String,timeIn:

Date)

+enterThirdPartyCustomer(accountNumber:

int)

+enterPayment(licenseNumber:

String,amount:

double)

+verifyCarLicense(licenseNumber:

String):

boolean

+verifyConfirmationNumber(confirmationNumber:

int):

boolean

+verifyExtraChargeCode(extraChargeCode:

String):

boolean

+verifyRateCode(carType:

String):

boolean

+verifyThirdPartyCustomer(accountNumber:

int):

boolean

CompleteSpecificationofAttributesandOperations–ApacheRentACar(Continued)

RateClass

Attributes

-carType:

String

-dailyRate:

double

-mileageRate:

double

-numberOfFreeMiles:

int

-weekEndRate:

double

-weeklyRate:

double

Operations

None

Rental

Attributes

-agreementNumber:

int

-mileageOut:

int

-timeOut:

Date

Operations

+associateDriver(checkOut:

CheckOut)

+associateExtraCharge(extraCharge,ExtraCharge)

+associateExtraChargeSpecification

(extraChargeSpecification,ExtraChargeSpecification)

+associateInspection(inspection,Inspection)

+associatePayment(payment,Payment)

+associateReservation(reservation,Reservation)

+associateReturn(return,Return)

+associateThirdPartyPayer

(thirdPartyCustomer,ThirdPartyCustomer)

+authorize(amount:

double,merchantNumber:

int):

boolean

+makeCreditCard(creditCardNumber:

String,

expirationMonth:

int,expiration

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1