IMSchach8thedChap12v7.docx

上传人:b****4 文档编号:6771202 上传时间:2023-05-10 格式:DOCX 页数:26 大小:294.88KB
下载 相关 举报
IMSchach8thedChap12v7.docx_第1页
第1页 / 共26页
IMSchach8thedChap12v7.docx_第2页
第2页 / 共26页
IMSchach8thedChap12v7.docx_第3页
第3页 / 共26页
IMSchach8thedChap12v7.docx_第4页
第4页 / 共26页
IMSchach8thedChap12v7.docx_第5页
第5页 / 共26页
IMSchach8thedChap12v7.docx_第6页
第6页 / 共26页
IMSchach8thedChap12v7.docx_第7页
第7页 / 共26页
IMSchach8thedChap12v7.docx_第8页
第8页 / 共26页
IMSchach8thedChap12v7.docx_第9页
第9页 / 共26页
IMSchach8thedChap12v7.docx_第10页
第10页 / 共26页
IMSchach8thedChap12v7.docx_第11页
第11页 / 共26页
IMSchach8thedChap12v7.docx_第12页
第12页 / 共26页
IMSchach8thedChap12v7.docx_第13页
第13页 / 共26页
IMSchach8thedChap12v7.docx_第14页
第14页 / 共26页
IMSchach8thedChap12v7.docx_第15页
第15页 / 共26页
IMSchach8thedChap12v7.docx_第16页
第16页 / 共26页
IMSchach8thedChap12v7.docx_第17页
第17页 / 共26页
IMSchach8thedChap12v7.docx_第18页
第18页 / 共26页
IMSchach8thedChap12v7.docx_第19页
第19页 / 共26页
IMSchach8thedChap12v7.docx_第20页
第20页 / 共26页
亲,该文档总共26页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

IMSchach8thedChap12v7.docx

《IMSchach8thedChap12v7.docx》由会员分享,可在线阅读,更多相关《IMSchach8thedChap12v7.docx(26页珍藏版)》请在冰点文库上搜索。

IMSchach8thedChap12v7.docx

IMSchach8thedChap12v7

Chapter12

ClassicalAnalysis

Inthischapter,threeapproachestospecificationarecompared:

formal,semiformal,andinformal.Ifeelthatstudentsshouldbeexposedtoasmanyformalmethodsaspossible.OnewaytointroducetheFSMmaterialtostudentswhohavehadnopriorexposuretoformalmachinesistodescribeamenu-basedproductwithwhichmoststudentsarefamiliar,suchasapopularword-processingpackageonaPC.Pointoutthateachmenucorrespondstoastate,andeachmenuchoicetoaninput.Oncestudentsappreciatethattheyhavebeendealingwithfinitestatemachinesforyears,Section12.7iseasytoteach.

StudentswhohavetakenanoperatingsystemscoursemaywellhavebeenexposedtoPetrinets.Also,thebasicconceptcanbeeasilyunderstoodbymostoftheclasswithoutmucheffortbytheinstructor.IbelievethatSection12.8shouldbecovered,ifonlytoensurethatstudentsareexposedtoPetrinets.However,notallstudentswillbeabletodoProblem12.17.

Ontheotherhand,IteachSections12.9and12.10toonlygraduatestudents.Furthermore,thereisonlyoneprobleminvolvingZattheendofthechapter.

problemsolutions

12.1:

Bothconstraintssuperficiallyappeartobepreciseandscientific,butneithercanbemeasuredortested.Specifically,

(i)Theterm“significantly”isimprecise—significantforwhom:

clientordeveloper?

Also,thisisareasonfordevelopingtheproduct,notaconstraint.

(ii)Theterm“reasonable”isimprecise—reasonableforwhom:

clientordeveloper?

12.2:

Anysuchomissions,contradictions,andambiguitieswillbecarriedoverintothedesignandimplementation.

12.3:

Ambiguities:

Isacloveoraheadofgarlictobeused?

Whatoperationsaretobeperformedthenightbefore?

Everything?

Whichjuiceistobestrained,orangeorlemon?

Whatistobefrozen,thelemonorjustthejuice?

Istheoniontobediced,orjusttheshallots?

Whichmixtureistobeblendedfor10minutes?

Does“blend”mean“mixbyhand”or“useanelectricblender?

Howarethelumpstoberemoved,withastrainerorablender?

Thelumpsinthemixturecouldbethemushrooms.

Twomixturesarespecified,thepockwesterisaddedtoonlyoneofthem:

which?

Howcanyoukilla“fresh”pockwester?

Theterms“simmer,”“bite-sized,”and“softtothetouch”areimprecise.

Wecanbroilforanytimefrom1microsecondto3minutes,59seconds.

WhatistobesprinkledwithParmesan—theservingplatter,orthepockwester?

Omissions:

Howlargeisa“largeonion”?

Whatsizecanoforangejuice?

Howlargealemon?

Whatkindofbreadforthecrumbs?

Howmuchflour?

Howmuchmilk?

Howlargearemedium-sizedshallots?

Howlargearemedium-sizedeggplants?

Whatsizepockwester?

Whatsizegarlic?

HowmuchParmesancheese?

Whatsizeeggs?

Thesugarisnotlistedintheingredients.

Norarethemushrooms.

Norarethefrobs.

Whatsizeplatteristobeused?

Contradictions:

Theingredientscallforfrozenorangejuice,therecipecallsforfresh.

Afterthelemonhasbeensqueezedthenightbefore,itisthensupposedtobesliced.

Wearetoldto“stirvigorously,”“slice,”and“inthemeantime”tocoat,dip,andsoon—itisimpossibletodoallthesethingsatonce.

Thefollowingitemsarecertainlyconfusing,buttheyarenotambiguities,omissions,orcontradictions:

Thelemonjuice,eggplant,andgarlicareneverused.

Grillinginaskilletisnotusuallyagoodidea.

Shakingupmushroomswetwithmilkinapaperbagisfraughtwithdifficulties.

Theinstructiontowhisktheeggsshouldprecedetheinstructiontoaddthemtoamixture.

Iftheblendingistobedonewithanelectricblender,10minutesseemstobetoolong.

Therecipecallsforfirstcoatingthemushroomsinflour,andthendippingtheminmilk;thismaybeunorthodox,butthensoismuchoftherestoftherecipe!

Twomixturesarespecified,thepockwesterisaddedtoonlyoneofthem;nothingismentionedregardingwhatistobedonewiththeotherone.

12.4:

Ifactualsalesforthecurrentmontharelessthanthetargetsalesforthecurrentmonth,checkwhetherthepercentagedifferencebetweentheactualsalesandthetargetsalesforthecurrentmonthis5percentormore.Ifso,checkwhethertherearesalesfiguresforthepreviousmonth.Ifso,checkwhetherthepercentagedifferencebetweentheactualsalesandtargetsalesforthecurrentmonthisgreaterthanorequaltohalfofthepercentagedifferencebetweentheactualsalesandtargetsalesforthepreviousmonth.Ifthisthirdconditionalsoholds,printareport.Otherwise,donothing.

12.5:

Foreachshop,theactualsalesforeachmontharecomparedwiththetargetsalesforthatmonth.

Theeffectivenessofagivenshopforagivenmonthisdefinedby

Theshortfallforagivenshopforagivenmonthisdefinedby

Ashopisdeemedtohaveachieveditsobjectiveforthecurrentmonthiftheshortfallforthecurrentmonthislessthanorequalto5%,oriftheshortfallforthecurrentmonthislessthanorequaltohalftheshortfallforthepreviousmonth;inthecaseofJanuary,theshortfallforthepreviousmonthisdeemedtobe0%.

Ifashophasnotachieveditsobjective,areportistobeprinted.

12.6:

Informalspecificationsareeasytouse,andareeasyfortheclienttounderstand.

12.7:

Informalspecificationsareimprecise.Theycanbeambiguous,contradictory,orincomplete.

12.8:

Thefollowingassumptionsaremade:

therearenoservicecharges,noATMwithdrawals.Theonlytransactionsthatareallowedarechecksanddeposits.Allchecksbearanumber.Theuserhasapileofcanceledchecks,andapileofdepositslips.

Figure12.1.Dataflowdiagramfordeterminingwhetherbankstatementiscorrect.

Sortthechecksincheck-numberorder.Foreachcheck,findanentryinthebankstatementthatmatchesthechecknumber.Ifnosuchentryisfound,thestatementisinerror.Otherwise,markthatentry,andverifythattheamountforthatentryisthesameasthatonthecheck.Iftheamountsdonotmatch,thestatementisinerror.

Sortthedepositslipsaccordingtodateofdeposit.Foreachdepositslip,findanentryinthestatementthatmatchesthedateofdepositandtheamountofthedeposit.Markthatentry.Ifnosuchentryisfound,thestatementisinerror.

Afterallchecksanddepositshavebeenprocessed,verifythatallitemsonthestatementhavebeenmarked.Ifnot,thestatementisinerror.

Addtheamountofalldepositstothebeginningbalance,andfromthatsumsubtractthetotalofallthechecks.Iftheresultofthatsubtractionisnotequaltotheendingbalancethenthestatementisinerror,otherwiseitiscorrect.

12.9:

SeeFigure12.1.

12.10:

Thisproductisconcernedwithbooks,borrowers,andlibrarians.Thelibraryhasacollectionofbooksthatborrowersmaycheckoutandsubsequentlyreturn.Eachbookhasauniquebooknumber.Affixedtoeachbookisalabelbearingthatnumberinbar-codeformat.

Eachborrowerhasauniqueborrowernumber.Eachborrowerhasacardbearingthatnumberinbar-codeformatthatisscannedwhentheborrowerchecksoutabook.BorrowersmaydetermineallthebooksbyaparticularauthorinthelibrarycollectionbygoingtoaterminalandenteringA=,allthebookswithaspecifictitlebyenteringT =,orallthebooksinaparticularsubjectareabyenteringS = .

LibrarianscheckoutabookbyenteringCataterminal,scanningtheborrowerbarcode,andscanningthebookbarcode.Ifthebookisnotbeingheldforanotherreader,itisissuedtotheborrower.Whenaborrowerreturnsabook,thelibrarianentersRataterminal,andscansthebookbarcode.Toaddanewbooktothecollection,thelibrarianenters+(plussign),thenumberofthenewbook,andotherbookdetails.Toremoveabookfromthecollection,thelibrarianenters–(minussign)andentersthebooknumber(bar-codeinputisinappropriate—thebookmayhavebeenstolen).AlibrariancanputaholdonabookforaborrowerbyenteringH=andscanningtheborrower’sbarcode.[Theneedfortheborrower’snumberwasintentionallyomittedfromtheproblemstatement;studentsshouldnotthoughtlesslyrewritetheproblemstatementinmoreformalterms,butactuallyconsidertheimplicationsofwhattheyarewriting!

]Abookmaynotbeheldifitisalreadybeingheldforanotherborrower.

12.11:

SeeFigure12.2.

12.12:

Step1.DrawDFD.Seepreviousproblem.

Figure12.2.Dataflowdiagramforlibrarycirculation.

Step2.Decidewhatsectionstocomputerize,andhow.ComputerizecompleteproductasshowninDFD,online.DFDdoesnotshowfunctionslikeissuingnewborrowerwithanIDnumberandcard,ormaintainingborrowerdetails.Thesefunctionswerenotincludedinthespecifications,anditisthereforeassumedthattheywillbeperformedmanually.

Step3.Detailsofdataflows.

book_ID

book_number

book_details

book_number

book_bibliographic_details

author

title

subject

other_details

borrower_ID

borrower_number

on_hold_data

borrower_numberifbookisonholdforanotherborrower,else0

Step4.Definelogicofprocesses.

addbook

Placebook_detailsinBOOK_DATA

checkoutbook

Readbook_ID,borrower_ID

Checkthatbookisnotbeingheldforanotherborrower

UpdateBOOK_DATAwithborrower_ID

holdbook

Readbook_ID,borrower_ID

Checkifbookisalreadyonhold

Ifnot,updateBOOK_DATAtoreflectborrower_ID

obtaincataloginformation

Readborrower’squery

SearchBOOK_DATA

Answerborrower’squery

removebook

Readbook_ID

Deletebook_detailsfromBOOK_DATA

returnbook

Readbook_number

UpdateBOOK_DATA

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

当前位置:首页 > 工程科技

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

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