版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1Chapter6RequirementsModeling:Scenarios,Information,andAnalysisClassesSoftwareEngineering:APractitioner’sApproach,7/e
byRogerS.Pressman2RequirementsAnalysisRequirementsanalysisspecifiessoftware’soperationalcharacteristicsindicatessoftware'sinterfacewithothersystemelementsestablishesconstraintsthatsoftwaremustmeetRequirementsanalysisallowsthesoftwareengineer(calledananalystormodelerinthisrole)to:elaborate(精化)onbasicrequirementsestablishedduringearlierrequirementengineeringtasksbuildmodelsthatdepictuserscenarios,functionalactivities,problemclassesandtheirrelationships,systemandclassbehavior,andtheflowofdataasitistransformed.3ABridge44TwoanalysismodelStructuredanalysis(SA)Object–orientedanalysis(OOA)
功能(用例)
模型
对象/行为模型
属性、
协作
操作、
对象/关
系模型
5ElementsofRequirementsAnalysis6Scenario-BasedModeling“[Use-cases]aresimplyanaidtodefiningwhatexistsoutsidethesystem(actors)andwhatshouldbeperformedbythesystem(use-cases).”IvarJacobson(1)Whatshouldwewriteabout?(描述什么)(2)Howmuchshouldwewriteaboutit?(描述多少)(3)Howdetailedshouldwemakeourdescription?(描述多细)(4)Howshouldweorganizethedescription?(描述结构)
7WhattoWriteAbout?Inceptionandelicitation—provideyouwiththeinformationyou’llneedtobeginwritingusecases.Requirementsgatheringmeetings,andotherrequirementsengineeringmechanismsareusedtodefinetheproblemscopespecifyoveralloperationalgoalsoutlineallknownfunctionalrequirementsdescribeobjectsthatwillbemanipulatedbysystemTobegindevelopingasetofusecases,listthefunctionsoractivitiesperformedbyaspecificactor.(考虑每一个角色是如何使用系统的)8HowMuchtoWriteAbout?Asfurtherconversationswiththestakeholdersprogress,therequirementsgatheringteamdevelopsusecasesfor
eachofthefunctions.usecasediagramascenariothatdescribesa“threadofusage”forasystemactors
representrolespeopleordevicesplayasthesystemfunctionsuserscanplayanumberofdifferentrolesforagivenscenario9Use-CaseDiagramascenariothatdescribesa“threadofusage”forasystemactors
representrolespeopleordevicesplayasthesystemfunctionsuserscanplayanumberofdifferentrolesforagivenscenario2026/6/710状态是对象执行了一系列活动的结果。当某个事件发生后,对象的状态将发生变化,这种变化用状态图来表示。状态图描述了单个对象在其整个生命周期中的行为。状态图由对象的状态及状态间的迁移构成。它既可用于模拟系统对象按事件发生顺序产生的各种行为,还可描述用例的一个脚本。状态是对象属性值的抽象,有时间上的持续性,可分为初始状态(用实心圆表示)、最终状态(用同心圆表示)、中间状态等。事件是指定时刻发生的事情,没有持续时间。通常,状态和事件是紧密相连的。节点表示状态,带箭头的连线表示状态的迁移。“do/活动”表明进入状态后对象执行的操作,为可选项。护卫条件是一个布尔表达式,其值如果为真,则触发状态转移,否则不触发。动作和事件的发生也可触发状态的转移。
StateDiagram(状态图)11StateDiagramReadingCommandsSystemstatus=“ready”Displaymsg=“entercmd”Displaystatus=steadyEntry/subsystemsreadyDo:polluserinputpanelDo:readuserinputDo:interpretuserinputStatenameStatevariablesStateactivities2026/6/712状态图的一个实例13ActivityDiagramSupplementstheusecasebyprovidingagraphicalrepresentationoftheflowofinteractionwithinaspecificscenario2026/6/714
ActivityDiagram
活动图用于描述从活动到活动的流。它可用来为系统的动态方面建模,还可用来描述用例脚本。在活动图中,一个活动结束后立即进入下一个活动(在状态图中状态的变迁可能需要事件的触发)。控制流从一个动作或活动状态传递到下一个动作或活动状态称为跃迁,跃迁可以用简单的有向线条表示。分叉表示将单一的控制流分成两个或多个并发的控制流,分叉有一个输入和多个输出,分叉路径相关的活动是并行的。联结代表两个或多个并发控制流的同步,联结有多个输入和一个输出,在联结上,与各路径有关的活动是并行的。活动图描述发生了什么,但没有说明该活动由谁来完成。泳道决定各个活动由哪个类来完成。泳道用矩形框表示,属于某个泳道的活动放在该矩形框中,将对象名放在矩形框的顶部,表示泳道中的活动由谁负责。2026/6/715ActivityDiagram:Example16SwimlaneDiagramsAllowsthemodelertorepresenttheflowofactivitiesdescribedbytheuse-caseandatthesametimeindicatewhichactororanalysisclasshasresponsibilityfortheactiondescribedbyanactivityrectangle17SwimlaneDiagrams泳道图18DataModelingexaminesdataobjectsindependentlyofprocessingfocusesattentiononthedatadomaincreatesamodelatthecustomer’slevelofabstractionindicateshowdataobjectsrelatetooneanother19WhatisaDataObject?arepresentationofalmostanycompositeinformationthatmustbeunderstoodbysoftware.canbeanexternalentity(e.g.,anythingthatproducesorconsumesinformation),athing(e.g.,areportoradisplay),anoccurrence(e.g.,atelephonecall)orevent(e.g.,analarm),arole(e.g.,salesperson),anorganizationalunit(e.g.,accountingdepartment),aplace(e.g.,awarehouse),orastructure(e.g.,afile).Thedescriptionofdataobjectincludesthedataobjectandallofitsattributes.Adataobjectencapsulatesdataonly—thereisnoreferencewithinadataobjecttooperationsthatactonthedata.20DataObjectsandAttributesAdataobjectcontainsasetofattributesthatactasanaspect,quality,characteristic,ordescriptoroftheobjectobject:automobileattributes:makemodelbodytypepriceoptionscode21ClassDiagramFromtheSafeHomesystem…类图是面向对象建模中最常用的图,也是其它图(状态图,协作图,组件图等)的基础,它描述的是类与类之间的静态关系。UML中的类图用一个矩形表示,它由三个区域构成,分别标注类名、属性和服务。22WhatisaRelationship?Dataobjectsareconnectedtooneanotherindifferentways.Aconnectionisestablishedbetweenpersonand
carbecausethetwoobjectsarerelated.ApersonownsacarApersonisinsuredtodrive(架车保险)
acarTherelationshipsownsand
insuredtodrive
definetherelevantconnectionsbetweenpersonandcar.SeveralinstancesofarelationshipcanexistObjectscanberelatedinmanydifferentways23ERDNotation(0,m)(1,1)objectobjectrelationship12Onecommonform:(0,m)(1,1)object1object2relationshipAnothercommonform:attribute24BuildinganERDLevel1—modelalldataobjects(entities)andtheir“connections”tooneanotherLevel2—modelallentitiesandrelationshipsLevel3—modelallentities,relationships,andtheattributesthatprovidefurtherdepth25TheERD:AnExample26Class-BasedModelingClass-basedmodelingrepresents:objectsthatthesystemwillmanipulateoperations(alsocalledmethodsorservices)thatwillbeappliedtotheobjectstoeffectthemanipulationrelationships(somehierarchical)betweentheobjectscollaborationsthatoccurbetweentheclassesthataredefined.Theelementsofaclass-basedmodelincludeclassesandobjects,attributes,operations,CRCmodels,collaborationdiagramsandpackages.27IdentifyingAnalysisClassesExaminingtheusagescenariosdevelopedaspartoftherequirementsmodelandperforma"grammaticalparse"Classesaredeterminedbyunderliningeachnounornounphrase.Iftheclass(noun)isrequiredtoimplementasolution,thenitispartofthesolutionspace;otherwise,ifaclassisnecessaryonlytodescribeasolution,itispartoftheproblemspace.28Manifestations(表现)ofAnalysisClassesAnalysisclassesmanifestthemselvesinoneoffollowingways:Externalentities
(e.g.,othersystems,devices,people)thatproduceorconsumeinformationThings(e.g,reports,displays,letters,signals)thatarepartoftheinformationdomainfortheproblemOccurrencesorevents
(e.g.,apropertytransferorthecompletionofaseriesofrobotmovements)thatoccurwithinthecontextofsystemoperationActors(e.g.,manager,engineer,salesperson)playedbypeoplewhointeractwiththesystemOrganizationalunits
(e.g.,division,group,team)thatarerelevanttoanapplicationPlaces
(e.g.,manufacturingfloororloadingdock)thatestablishthecontextoftheproblemandtheoverallfunctionStructures(e.g.,sensors,four-wheeledvehicles,orcomputers)thatdefineaclassofobjectsorrelatedclassesofobjects29PotentialClassesRetainedinformation.Thepotentialclasswillbeusefulifinformationmustberememberedsothatthesystemcanfunction.Neededservices.Thepotentialclassmusthaveasetofidentifiableoperationsthatcanchangethevalueofitsattributesinsomeway.Multipleattributes.Duringrequirementanalysis,thefocusshouldbeon"major"information;aclasswithasingleattributemaybeusefulduringdesign,butisprobablybetterrepresentedasanattributeofanotherclassduringtheanalysisactivity.Commonattributes.Asetofattributescanbedefinedforthepotentialclassandtheseattributesapplytoallinstancesoftheclass.Commonoperations.Asetofoperationscanbedefinedforthepotentialclassandtheseoperationsapplytoallinstancesoftheclass.Essentialrequirements.Externalentitiesthatappearintheproblemspacetotheoperationofanysolutionforthesystemwillalmostalwaysbedefinedasclassesintherequirementsmodel.30DefiningAttributesAttributesdescribeaclassthathasbeenselectedforinclusionintheanalysismodel.buildtwodifferentclassesforprofessionalbaseball(棒球)playersForPlayingStatisticssoftware:
name,position,batting(击球)average,fielding(防守)percentage,yearsplayed,andgamesplayedmightberelevantForPension(养老金)Fundsoftware:averagesalary,credittowardfullvesting(三金五险),pensionplanoptionschosen,mailingaddress,andthelike.又如:学生可以定义为“学生档案(反映个人基本情况的属性)”和“学生成绩(反映学习情况的属性)”两个不同的类。31DefiningOperationsDoagrammaticalparseofaprocessingnarrativeandlookattheverbsOperationscanbedividedintofourcategories:(1)operationsthatmanipulatedatainsomeway(e.g.,adding,deleting,reformatting,selecting)(2)operationsthatperformacomputation(3)operationsthatinquireaboutthestateofanobject(4)operationsthatmonitoranobjectfortheoccurrenceofacontrollingevent.32ClassTypesEntityclasses,alsocalled
model
or
businessclasses,areextracteddirectlyfromthestatementoftheproblem(e.g.,Sensor).Boundaryclasses
areusedtocreatetheinterface(e.g.,interactivescreenorprintedreports)thattheuserseesandinteractswithasthesoftwareisused.Controllerclassesmanagea“unitofwork”fromstarttofinish.Thatis,controllerclassescanbedesignedtomanagethecreationorupdateofentityobjects;theinstantiation(实例)ofboundaryobjectsastheyobtaininformationfromentityobjects;complexcommunicationbetweensetsofobjects;validationofdatacommunicatedbetweenobjectsorbetweentheuserandtheapplication.33CRCModelsClass-responsibility-collaborator(CRC)modelingAmbler[Amb95]describesCRCmodelinginthefollowingway:ACRCmodelisacollectionofstandardindexcardsthatrepresentclasses.Thecardsaredividedintothreesections.Alongthetopofthecardyouwritethenameoftheclass.Inthebodyofthecardyoulisttheclassresponsibilitiesontheleftandthecollaboratorsontheright.34CRCModeling35ResponsibilitiesEachresponsibilityshouldbestatedasgenerallyaspossibleInformationandbehaviorrelatedtoitshouldresidewithinthesameclassInformationaboutonethingshouldbelocalizedwithasingleclass,notdistributedacrossmultipleclasses.
Responsibilitiesshouldbesharedamongrelatedclasses,whenappropriate.36CollaborationsClassesfulfilltheirresponsibilitiesinoneoftwoways:Aclasscanuseitsownoperationstomanipulateitsownattributes,therebyfulfillingaparticularresponsibility,oraclasscancollaboratewithotherclasses.CollaborationsidentifyrelationshipsbetweenclassesCollaborationsareidentifiedbydeterminingwhetheraclasscanfulfilleachresponsibilityitselfthreedifferentrelationshipsbetweenclasses:theis-part-of
relationshipthehas-knowledge-ofrelationshipthedepends-upon
relationship37CompositeAggregate(聚合关系)代表“整体与部分”的关系38AssociationsandMultiplicity(多样性)TwoanalysisclassesareoftenrelatedtooneanotherinsomefashionInUMLtheserelationshipsarecalledassociationsAssociationscanberefinedbyindicating
multiplicity代表“一般与特殊”的关系39Dependencies(依赖性)Inmanyinstances,aclient-serverrelationshipexistsbetweentwoanalysisclasses.Insuchcases,aclient-classdependsontheserver-classinso
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 呼吸内科慢性阻塞性肺疾病急性加重期处理要点
- 大学生面试自我介绍设计指南
- 地铁线路设计
- 肾内科慢性肾衰竭血液透析护理管理细则
- 运动员顽强拼搏的精神
- 角色设计手绘课件
- 全科医学科慢性病综合干预方案指南
- 神经科帕金森病监测流程指南
- 网络订餐系统设计
- 顶墙设计系统解决方案
- 烟化炉车间技术、安全及设备维护保养手册
- 国家OTC药品目录(全部品种)
- 2023学年完整公开课版东南亚4
- 川2020J146-TJ 建筑用轻质隔墙条板构造图集
- 空气预热器检修工艺标准
- 测井沉积相课件
- 安全生产组织架构
- 超前钻勘查工程合同
- 弱电智能化工程施工组织设计方案方案
- LY/T 1697-2007饰面木质墙板
- GB/T 33656-2017企业能源计量网络图绘制方法
评论
0/150
提交评论