01use case单击此处编辑母版标题_第1页
01use case单击此处编辑母版标题_第2页
01use case单击此处编辑母版标题_第3页
01use case单击此处编辑母版标题_第4页
01use case单击此处编辑母版标题_第5页
已阅读5页,还剩54页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

UsecasemodelingUsecasemodelingFindactorsandusecasesDetailusecaseUsecasespecificationscenariosWhentoapplyusecasemodeling1.UsecasemodelingAformofrequirementsengineering,andadifferentandcomplementarywayofelicitinganddocumentingrequirementsActivities: -Findthesystemboundary -Findtheactors -Findtheusecases:A.specifytheusecase;B.Createscenarios.Fourcomponents:-Actors:rolesplayedbypeopleorthingsthatusethesystem-Usecase:thingsthattheactorscandowiththesystem -Relationships:meaningfulrelationshipsbetweenactorsandusecases -Systemboundary:aboxdrawnaroundtheusecasestodenotetheedgeorboundaryofthesystembeingmodeled.2.

FindactorsandusecasesUPactivityDecidetheboundaryofasystemIdentifyactorsIdentifyusecases2.1.ThesystemboundaryIsdefinedbywhoorwhatusesthesystemandwhatspecific(i.e.,actors)benefitsthesystemofferstothoseactors(i.e.usecases).Definewhatispartofthesystem(insidethesystemboundary)andwhatisexternaltoyoursystem(outsidethe systemboundary). Drawnasabox,labeledwiththenameofthesystem,withtheactorsdrawnoutsidetheboundaryandtheusecasesinside.2.2WhatareactorsSpecifiesarolethatsomeexternalentityadoptswheninteractingwithyoursystemdirectly.Mayrepresentauserrole,oraroleplayedbyanothersystem,thattouchestheboundaryofyoursystemRealizethatactorsarealwaysexternaltothesystem.ActorsarerepresentedinUMLasshowninFigure4.3onPage58.Forexample:AnonlineCourseRegistrationSystem: Actor–studentsthatregistercoursesstudents2.2.IdentifyingactorsConsiderwhoorwhatusesthesystem,andwhatrolestheyplayintheirinteractionswiththesystemAskingthefollowingquestionswillhelptoidentifyactors:Whoorwhatusesthesystem?Whatrolesdotheyplayintheinteraction?Whoinstallsthesystem?Whostartsandshutsdownthesystem?Whomaintainsthesystem?Whatothersystemsinteractwiththissystem?Whogetsandprovidesinformationtothesystem?Doesanythinghappenatafixedtime?Rememberthefollowingpoints: -Actorsarealwaysexternaltothesystem-theyarethereforeoutsideyourcontrol -Actorsinteractdirectlywiththesystem-thisishowtheyhelptodefinethesystemboundary. -Actorsrepresentrolesthatpeopleandthingsplayinrelationtothesystem,notspecificpeopleorspecificthings.-OnepersonorthingmayplaymanyrolesinrelationtothesystemsimultaneouslyorovertimeEachactorneedsashortnamethatmakessensefromthebusinessperspectiveEachactormusthaveashortdescriptionthatdescribeswhatthisactorisfromabusinessperspective.Likeclasses,actorsmayhavecompartmentsthatshowattributesoftheactorandeventsthattheactormayreceive.2.3.Timeasanactor-Whenyouneedtomodelthingsthathappentoyoursystemataspecificpointintimebutwhichdon’tseemtobetriggeredbyanyactor,youcanintroduceanactorcalledTime.-Forexample:Automatedsystembackupthatrunseveryevening.2.4.Whatareusecases?Aspecificationofsequencesofactions,includingvariantsequencesanderrorsequences,thatasystem,subsystemorclasscanperformbyinteractingwithoutsideactors.Ausecaseissomethinganactorwantsthesystemtodo,describesbehaviorthatthesystemexhibitstobenefitoneormoreactors.UMLiconforusecasesisshownbelow.Registercourses2.4.Whatareusecases?NotethatUsecasesarealwaysstartedbyanactorUsecasesarealwayswrittenfromthepointofviewofanactor.3.5.IdentifyingusecasesBestwaytoidentifyusecases:startwiththelistofactors,andthenconsiderhoweachactorisgoingtousethesystem.Somehelpfullistofquestionsthatyoucanaskwhentryingtoidentifyusecases: -whatfunctionswillaspecificactorwantfromsystem? -Doesthesystemstoreandretrieveinformation?Ifso,whichactorstriggerthisbehavior? -Areanyactorsnotifiedwhenthesystemchangesstate? -Arethereanyexternaleventsthataffectthesystem?Whatnotifiesthesystemaboutthoseevents?3.6.TheusecasediagramRepresentthesystemboundarybyaboxlabeledwiththenameofthesystem.Putactorsoutsidethesystemboundary.Putusecasesinsidethesystemboundary.Relationshipbetweenanactorandausecaseisshownusingasolidline.Forexample:CourseregistrationsystemEnquirecoursesRegistercoursesCancelcoursesstudentUsecaseSystemnameactorCommunicationrelationshipSystemboundary4.UPactivity:detailausecase4.4.1.UsecasespecificationThereisnoUMLstandardforausecasespecification.Usecasehasanameandaspecification.TemplateshowninFigure4.8onPage64iscommonuse.Consistsofthefollowing: -Preconditions -Flowofevents -PostconditionsUsecase:PayVatID:UC1Actors:TimeGovernmentPreconditions1.ItistheendofabusinessquarterFlowofEventsTheusecasestartswhenitistheendofthebusinessquarterThesystemdeterminestheamountofvaluesaddedtax(Vat)owedtothegovernmentThesystemsendsane-paymenttothegovernmentPostconditions:1.TheGovernmentreceivesthecorrectamountofVAT.

Usecasename:UniqueIdentifierTheactorsinvolvedintheusecaseThesystemstatebeforeTheusecasecanbeginTheactualstepsoftheusecaseThesystemstatewhentheusecaseisover4.1.1.PreconditionsandPostconditionsPreconditions:truebeforetheusecasecanexecute,Constrainthestateofthesystembeforetheusecasecanstart.Thinkofthemasgatekeepersthatpreventanactorfromtriggeringtheusecaseuntilalltheirconditionsaremet.Postconditions:specifywhatwillbetrueaftertheusecasehasexecuted.constrainthestateofthesystemaftertheusecasehasexecuted.4.1.2.FlowofEventsDescribesstepsinausecase,consistsofasequenceofshortstepsthatdeclarative,numbered,andtime-ordered.Eachstepshouldbeintheform: <number>The<something><someaction>.Italwaysbeginsbyanactordoingsomethingtotriggertheusecase.AGoodwayofstartaflowofeventsis: -Theusecasestartswhenan<actor><function>.Forexample:Theusecasestartswhenthestudentselectsregistercourses4.1.2.FlowofEvents(2)Remember:1).timecanbeanactor,sotheusecasemayalsostartwithatimeexpressioninplaceoftheactor.2).Usecaseshouldbeaprecisestatementofapieceofasystemfunctionality.Whenyouencountertroubleduringtheprocessofanalysis,askthefollowingquestions: -Whospecifically…? -Whatspecifically…? -Whenspecifically…? -Wherespecifically…?4.2.BranchingwithinaflowofeventsManypossibilitieswithintheflowofevenets.simplifybyreducingthenumberofusecase.Introduceasimplesetofkeywordsthatyoucanusetoexpressbranching,repetition,andevenalternativeflows.4.2.1.KeywordIfUseIftoindicateabranchintheflowofevents.4.2.2.AlternativeflowscannoteasilyexpressbranchingusingifmayoccuratanypointintheflowNote:ItisbesttoexpressbranchingthatcanhappenatanypointintheflowofeventsasoneormorealternativeflowsWhenappendanewalternativeflowtotheendofusecase,youmustcontainthefollowing: -Theflowofevents -Thepostconditionforthisflowofevents4.3.Repetitionwithinaflow:ForWhenrepeatanactionseveraltimeswithinaflowofevents,youcanmodelrepetitionbyusingthekeywordFor.Format:n.For(Iterationexpression) n.1.Dosomething n.2.Dosomethingelse n.3.…Forexample(seeFigure4.11onpage69)4.4.Repetitionwithinaflow:WhileUsewhilekeywordtomodelasequenceofactionsintheflowofeventsthatisperformedwhilesomeBooleanconditionistrue.Theformat: n.while(Booleancondition) n.1.dosomething n.2.dosomethingelse n.3.… n+1.4.5.RequirementsTracingUsingRequirementTraceabilityMatrix,requirementsinaSystemRequirementSpecificationmaybetracedtousecases.UC1UC2UC3UC4R1XR2XR3XR4XR5XRequiremnetUsecase5.ComplexUseCasesUsecaseshouldbekeptassimpleaspossible.Forcomplexusecases,decomposethemintoseveralscenarios:Eachcomplexusecasehasexactlyoneprimaryscenario.Eachcomplexusecasemayhavemanysecondaryscenarios.5.1.ScenariosAnotherwayoflookingatusecase.Asequenceofstepsdescribinganinteractionbetweenauserandasystem.isonespecificpaththroughausecase.Theimportantfeatureofscenarios:TheydonotbranchEachpossiblebranchintheusecaseflowpotentiallygeneratesaseparatescenarioExample:riverwithmanybranchingchannels5.2.SpecifyingtheprimaryscenarioWhenusingscenarioapproachfordocumentingusecases,theusecasespecificationcontains:theprimaryscenarioalistofthenamesofthesecondaryscenariosunderanappropriatelytitledsection.Usecase:CheckoutID:UC14Actors:CustomerPreconditions:Primaryscenario:1.Theusecasebeginswhenthecustomerselects“gotocheckout”2.Thesystemdisplaysthecustomerorder3.Thesystemasksforthecustomeridentifier.4.Thecustomerentersavalidcustomeridentifier5.……11.Thesystemdisplaysaninvoice.Secondaryscenarios:InvalidCustomerIdentifierInvalidCreditCardDetailsCreditCardLimitExceededPostconditions5.3.SpecifyingthesecondaryscenarioInthesamewaythatyouspecifyusecasesMustbetraceablebacktoitsusecaseCanreferencetheprimaryscenariointheirflowofevents.Usecase:CheckoutSecondaryscenario:InvalidCustomerIdentifierID:UC15Actor:CustomerPreconditions:SecondaryScenario:1.Theusecasebeginsstep3oftheprimaryusecase:checkoutwhenthecustomerentersaninvalidcustomeridentifier2.Forthreeinvalidentries:2.1.Thesystemasksthecustomertoenterthecustomeridentifieragain3.Thesysteminformsthecustomerthattheircustomeridentifierwasnotrecognized.Postconditions:5.4.FindingsecondaryscenariosInspecttheprimaryscenarios.Lookfor:PossiblealternativeflowsErrorsthatmightberaised;Interruptsthatmightoccurtotheflow–thingsthatmighthappenatanytime.5.5HowmanyscenariosKeeptheamountofinformationcapturedtothenecessaryminimum.PickmostimportantsecondaryscenariosanddocumentthoseForsimilarsecondaryscenarios,justaddnotestoexplaindifferences.ProjectGlossaryProvidedefinitionsofkeybusinesstermsRecordthepreferredtermandlistanysynonymsMustsolvethefollowing:Synonyms:differentwordsthatmeanthesamethingHomonyms:thesamewordmeansdifferentthingstodifferentpeople.UMLdoesnotsetanystandardKeepassimpleandconciseaspossible6.Whentoapplyusecasemodeling(1)Thebestchoiceforrequirementscapturewhen:thesystemisdominatedbyfunctionalrequirements;ThesystemhasmanytypesofuserstowhichitdeliversdifferentfunctionalityThesystemhasmanyinterfaces(therearemanyactors).6.Whentoapplyusecasemodeling(2)Usecasesarethepoorchoiceforrequirementscapturewhen: Thesystemisdominatedbynon-functionalrequirementsThesystemhasfewusersThesystemhasfewinterfaces.AdvancedUseCaseModelingActorGeneralizationUseCaseGeneralization<<include>><<extend>>Whentoapplyadvancedusecase1.ActorGeneralizationAgeneralizationrelationshipbetweenamoregeneralactorandamorespecificactor.Findingactorgeneralization: -Factoroutacommonbehavior; -Findparentactors(abstractactors)andchild actors(concreteactors).Note: -Theparentactorinactorgeneralizationdoesnotalwayshavetobeabstract:Itmaybeaconcreterolethatapersonorsystemcouldplay.However,goodstyledictatesthatparentactorsareusuallyabstract. -Iftwoactorscommunicatewiththesamesetofusecasesinthesameway,wecanexpressthisasageneralizationtoanotheractor.CustomerSalesAgentSalesSystemListProductsOrderProductsAcceptPaymentCalculateCommissionOrderProductsAcceptPaymentGeneralizationCustomerSalesAgentPurchaserCalculateCommissionListProductsSalessystem2.UseCaseGeneralization(1)Ageneralizationrelationshipbetweenamoregeneralusecaseandamorespecificusecase.ChildusecasesrepresentmorespecificformsoftheparentFindusecasegeneralization: -Factoroutbehaviorcommontooneormoreusecasesintoaparentusecase. -Findparentusecasesandchildusecases.Note: -Thechildusecasesautomaticallyinheritsallfeaturesfromitsparent.

2.UseCaseGeneralization(2)Forchildusecases,theymay: -Inheritfeaturesfromtheirparentusecase; -Addnewfeatures; -Override(change)inheritedfeatures.Note:NoteverytypeofusecaseelementmaybeoverriddenUsecaseelementInheritAddOverrideRelationshipYYNPreconditionYYYPostconditionYYYStepinmainflowYYYAlternativeflowYYYAttributeYYNOperationYYYTable5.1ExamplesFindProductFindBookFindCDCustomerSalessystem3.<<include>>Factoroutstepscommontoseveralusecasesintoaseparateusecasewhichisthenincluded.Thekeywordinclude

isusedtoincludethebehaviorofanotherusecase.Includingusecaseiscalledclientusecase,andtheincludedusecaseiscalledsupplierusecase.Note:Mustspecifytheexactpointintheclientusecasespecification.Syntax:include(supplierUseCaseName)Forexample:Personnelsystem4.<<extend>><<extend>>provideawaytoaddnewbehaviortoanexisting(base)usecase.ThusWehaveBaseusecasesandextensionusecases.Baseusecasehasextensionpointsinanoverlaponitsflowofevents-extensionpointsoccurbetweenthestepsintheflowofevents.Thebaseusecaseiscompletewithouttheinsertionsegments–theextendedusecasedoesnotknow4.1.ExtensionusecaseExtensionusecasesaregenerallynotcompleteusecasesandthuscan’tusuallybeinstantiated.Consistsofoneormorebehaviorfragmentsknownasinsertionsegments.Extensionusecasesprovideinsertionsegments<<extend>>relationshipbetweentheextensionusecasesandthebaseusecasesspecifiestheextensionpointsthattheextensionusecaseinsertionsegmentsarepluggedinto.4.1.Extensionusecase(con’t)Thefollowingrulesapply:The<<extend>>relationshipmustspecifyoneormoreoftheextensionpointsinthebaseusecaseoritisassumedthatthe<<extend>>relationshipreferstoallextensionpointsTheextensionusecasemusthavethesamenumberofinsertionsegment.Itislegalfortwoextensionusecasesto<<extend>>thesamebaseusecaseatthesameextensionpoint.4.2MultipleInsertionSegmentsCanhavemultipleinsertionsegmentsinanextensionusecase.5.3.ConditionalExtensionsBooleanguardconditionsonthe<<extend>>relationshipallowaninsertioniftrue,andpreventaninsertioniffalse.WhentouseadvancedfeaturesWhentheysimplifytheusecasemodel.Actorgeneration:useonlywhereitsimplifiesthemodel.Usecasegeneralization:considernotusing,oronlyusingwithabstractparents<<include>>:useonlywhereitsimplifiesthemodel<<extend>>:considernotusing.Note:CapturethenecessaryinformationasclearandconciseaspossibleIfindoubt,leaveitout.HintsandTipsforwritingusescasesKeepusecasesshortandsimpleFocusontheWhat,notthehowRememberthatyouarewritingusecasestoworkoutwhattheactorsneedthesystemtodo,nothowthesystemshoulddo.Keepthedetailsofthedesign(whichyoudon’tknowyet)outoftheusecase3.AvoidfunctionaldecompositionOnecommonerrorinusecaseanalysisistocreateasetof“highlevel”usecases,andthenbreakthesedownin

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论