StudentAnswersChapter05Word文档下载推荐.docx

上传人:b****1 文档编号:3734168 上传时间:2023-05-02 格式:DOCX 页数:7 大小:66.52KB
下载 相关 举报
StudentAnswersChapter05Word文档下载推荐.docx_第1页
第1页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第2页
第2页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第3页
第3页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第4页
第4页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第5页
第5页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第6页
第6页 / 共7页
StudentAnswersChapter05Word文档下载推荐.docx_第7页
第7页 / 共7页
亲,该文档总共7页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

StudentAnswersChapter05Word文档下载推荐.docx

《StudentAnswersChapter05Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《StudentAnswersChapter05Word文档下载推荐.docx(7页珍藏版)》请在冰点文库上搜索。

StudentAnswersChapter05Word文档下载推荐.docx

Asitisresponsibleformaintainingdata,itmightbearguedthattheentitystereotypewasappropriate.Thisstereotypeisnormallyusedfordatainthesystemthatrepresentsasingleexternalentity,however.Therestaurantobjectdoesnotrepresentanentityinthissense,however,butinsteadmakesotherentitiesavailableinthesystem.Theentitystereotypeisprobablynotappropriatefortherestaurantobject,therefore.

Thereisacontrolaspecttotherestaurantobject,asitiscontrollingaccesstotheentitydataheldbythesystem.Thisismoreaquestionofbeinga`gatekeeper'

tosomesystemresourcesthancontrollinganumberofinteractions,asthebookingsystemobjectdoes,anditisprobablyclearernottorepresentbothbythesamestereotype.

Itthereforeappearsthatnoneoftheanalysisclassstereotypesstraightforwardlyappliestotherestaurantobject,andithasbeenleftinFigure5.4asaplainobject.

SuggestedanswerforExercise5.2

Thedateattributeinthebookingsystemclassrepresentsthedateforwhichbookinginformationiscurrentlybeingdisplayedbythesystem.Thedateattributeinthe`current'

bookingsshouldbethesameasthis,therefore,otherwisethesystemwillbedisplayingbookingsforthewrongdate.Thiscanbespecifiedbyaconstraintonthe`current'

associationasshownbelow.

SuggestedanswerforExercise5.3

Onthefaceofit,thisproposalmightseemtobeattractiveonthegroundsofremovingredundancy,followingtheguidelinethatdatashouldnotbestoredinmorethanoneplace.However,removingthedateattributefromthebookingsystemobjectwouldcreateproblemsinthesituationwheretherearenobookingsyetrecordedforadatethesystemisaskedtodisplay.Inthiscase,thesystemwouldhavenorecordofwhatdatewascurrentlybeingdisplayed.Ifawalk-inbookingwasthencreated,forexample,itwouldbedifficulttoworkoutthedaterequiredforthenewbookingobject.

Thissuggeststhatstoringthedateinbothclassesisnotinfactredundant,asthetwooccurrencesoftheattributehavedifferentsemantics,onereferringtothedatebeingdisplayedbythesystem,andtheothertothedateofanindividualbooking.Incaseslikethis,careneedstobetakenbefore`optimizing'

oneoftheattributesaway.

SuggestedanswerforExercise5.4

Producingarealizationforthisscenarioinvolvesdecidingwhichobjectisresponsiblefordetectingthatthedateisinvalid.Areasonableguidelinetoadopthereistovalidateuser-entereddataassoonaspossible.Thiswouldmeanthatthebookingsystemobjectshouldberesponsiblefordetectingerrors,andsoarealizationmightbeasfollows.

Therestaurantandbookingobjectshavebeenleftonthisdiagramtoemphasizethattheydonotreceiveanymessagesinthecourseofthisinteraction.Itisnotnecessaryatthislevelofdetailtoattempttospecifyhowthesystemreportstheerrortotheuserandrequestsreentryofthedate.Wecansimplyassumethatwhentheuserreentersthedateanewsystemmessagewillbegenerated,andeithertheinteractionaboveortheoneinFigure5.5willtakeplaceagain.

SuggestedanswerforExercise5.5

Thecompletesequencediagramisshownbelow.

SuggestedanswerforExercise5.6

Thesequencediagramfor`Recordwalk-in'

isshownbelow.Apartfromchangingtheactor,classandoperationnamesthroughouttorefertowalk-ins,themostsignificantchangeisthatacustomerobjectdoesnotneedtobelocated.Detailsreferringtocustomershavethereforebeenremovedfromthediagram.

SuggestedanswerforExercise5.7

Arealizationforthecasewherethecustomerisalreadyknowntothesystemisshowninthediagrambelow.AsinFigure5.5,therestaurantobjectretrievesdatafromcustomerobjectstocomparewiththenameandphonenumberoftherequestedcustomer.Assumingthatamatchisfound,acustomerobjectisreturnedtothecaller.

Inthecasewherenomatchingcustomerisfound,anewinstanceiscreatedandareferencetoitisreturnedtothecaller,asshownbelow.

SuggestedanswerforExercise5.8

Apossiblesequencediagramfortabletransferisshownbelow.Therequiredtableisfirstselected,asshowninFigures5.9and5.11.Thenthetableobjectcorrespondingtothenumberofthenewtableisretrievedfromtherestaurantobject,asinFigure5.8.Finally,thetableallocatedtotheselectedbookingisupdated,andthedisplayrefreshed.

Analternativedesignmightpassthetablenumbertotheselectedbooking,whichwouldthenhavetoretrievetherequiredtableobjectfromtherestaurantitself.Thisdesignisslightlymore`decentralized'

thantheoneabove,butontheotherhandintroducesacirculardependencybetweenthebookingandrestaurantclasses.Thedesignshownaboveisthereforeprobablypreferable.

SuggestedanswerforExercise5.9

ThediagramsbelowshowtheclassesfromFigure5.13withtypeinformationaddedtoattributesandoperations.TheadditionsarestrictlybasedonwhatisstatedinthevariousrealizationsgiveninChapter5,anddonotattempttodefinefinalsignaturesfortheoperations.Thiswillbeconsideredlaterwhenimplementingeachclass.

Wheredetailedparametershavenotyetbeendefined,typessuchasBookingIdandBookingDetailshavebeenusedasplaceholders.TheOCLcollectiontypeSet(T)hasbeenusedtoindicatethattheRestaurant.getBookingsoperationreturnsingeneralmorethanonebookingsobject.

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

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2