您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 工程监理 > 软件工程-实践者的研究方法(6)
1Chapter7RequirementsModeling:FlowandBehaviorSoftwareEngineering:APractitioner’sApproach,7/ebyRogerS.Pressman2RequirementsModelingStrategiesOneviewofrequirementsmodeling,calledstructuredanalysis,considersdataandtheprocessesthattransformthedataasseparateentities.Dataobjectsaremodeledinawaythatdefinestheirattributesandrelationships.Processesthatmanipulatedataobjectsaremodeledinamannerthatshowshowtheytransformdataasdataobjectsflowthroughthesystem.Asecondapproachtoanalysismodeled,calledobject-orientedanalysis,focusesonthedefinitionofclassestheycollaboratewithoneanothertoeffectcustomerrequirements.3Flow-OrientedModelingRepresentshowdataobjectsaretransformedattheymovethroughthesystemdataflowdiagram(DFD)isthediagrammaticformthatisusedConsideredbymanytobean“oldschool”approach,butcontinuestoprovideaviewofthesystemthatisunique—itshouldbeusedtosupplementotheranalysismodelelements4FlowModelingNotationexternalentityprocessdataflowdatastore5ExternalEntityAproducerorconsumerofdataExamples:aperson,adevice,asensorDatamustalwaysoriginatesomewhereandmustalwaysbesenttosomething6ProcessAdatatransformer(changesinputtooutput)Examples:computetaxes,formatreport,displaygraphDatamustalwaysbeprocessedinsomewaytoachievesystemfunction7DataFlowDataflowsthroughasystem,beginningasinputandtransformedintooutput.computetriangleareabaseheightarea8DataStoresDataisstoredforlateruse.look-upsensordatasensor#reportrequiredsensor#,type,location,agesensordatasensornumbertype,location,age9DataFlowDiagramming:GuidelinesalliconsmustbelabeledwithmeaningfulnamestheDFDevolvesthroughanumberoflevelsalwaysbeginwiththelevel0donotrepresentprocedurallogicsourcedestination1A2B3Ccefdbab2.12.22.3de1F10ConstructingaDFD—Ireviewuserscenariosand/orthedatamodeltoisolatedataobjectsanduseagrammaticalparsetodetermine“operations”determineexternalentities(producersandconsumersofdata)createalevel0DFD11Level0DFDExampleuserprocessingrequestvideosourceNTSCvideosignaldigitalvideoprocessorrequestedvideosignalmonitorConstructingaDFD—I12ConstructingaDFD—IItodeterminenextleveltransformsEachsub-DFDprovidesamoredetaileddescription“balance”theflowtomaintaindataflowcontinuityeachProcessisrefineduntilitdoesjustonethingmostsystemsrequirebetween3and7levelsforanadequateflowmodelasingledataflowitem(arrow)maybeexpandedaslevelsincrease13TheDataFlowHierarchyPabxyp1p2p3p45abcdefglevel0level1教材管理系统的顶层DFD学生教材购销管理系统书库保管员购书单领书单缺书单进书通知ConstructingDFD—Example教材管理系统可分为:销售子系统和采购子系统销售子系统:由教师或学生提交购书单,经教材科发行人员审核是有效购书单后,开发票、登记并返给学生领书单,学生凭领书单领书。采购子系统:若是脱销教材,则登记缺书信息,并发缺书单给书库采购人员;一旦新书入库后,即发进书通知告知系统。15学生书库保管员第一层DFD图—教材管理系统购书单领书单1销售2采购进书通知F2:缺书登记表F1:教材存量表缺书单进书通知ConstructingDFD—Example16ConstructingDFD—Example1.1审查有效性1.2开发票有效购书单1.3开领书单发票1.4登记缺书1.5补售教材F2:缺书登记表学生学生无效书单领书单领书单F3:各班学生用书表F4:售书登记表补售书单暂缺书单采购子系统第二层DFD图—销售子系统F1:教材存量表进书通知17ConstructingDFD—Example2.3修改教材库存和待购量2.1按书号汇总缺书F2:缺书登记表销售子系统书库保管员F1:教材存量表进书通知第二层DFD图—采购子系统2.2按出版社统计缺书F5:待购教材表F6:教材一览表进书通知18MapsintoDFDs:ALookAheadanalysismodeldesignmodel19ProcessSpecification(PSPEC)PSPECnarrativepseudocode(PDL)equationstablesdiagramsand/orchartsbubble20ProcessSpecification(PSPEC)21ControlSpecification(CSPEC)Represents“events”andtheprocessesthatmanageevents.An“event”isaBooleancondition.TheCSPECcanbe:statediagram(sequentialspec)structuredlanguagedecisiontable/treeactivationtablescombinatorialspec22ControlSpecification-StructuredLanguage一种介于自然语言和形式化语言之间的语言。结构化语言的词汇表由英语命令动词数据词典中定义的名字语言的正文用基本控制结构进行分割,加工中的操作用自然语言短语来表示。基本控制结构有三种:简单陈述句结构;重复结构:while_do或repeat_until结构;判定结构:if_then_else或case_of结构。23StructuredLanguage-Example“检查发货单”的过程描述if发货单金额超过$500thenif欠款超过60天then在偿还欠款前不予批准else(欠款未超期)发批准书,发货单else(发货单金额未超过$500)if欠款超过60天then发批准书,发货单及赊欠报告else(欠款未超期)发批准书,发货单24判定表的构造方法:1)列出与一个具体过程有关的全部操作。2)列出该过程执行期间的所有条件或作出的判定3)找出每个可能的组合,将各组特定的条件与特定操作相结合,并消去那些不可能发生的条件组合。4)指出在什么样的一组条件下将采取什么样的操作。如果算法中包含多重嵌套的条件选择时,用判定表能清晰地表达条件组合与动作之间的对应关系.ControlSpecification-DecisionTable25ControlSpecification-DecisionTree判定树与判定表的逻辑处理相似,但比判定表的语义表达上更直观。判定树中,每个枝节点(子树的根)对应于一个判定条件,而叶节点则对应于系统的一个可能的动作。判定树中,从根到叶的每条路径上所有枝节点对应于一种条件组合取值下的特定动作。26DecisionTable/Tree-Examples27BehavioralModeling&StateRepresentationThebehavioralmodelindicateshowsoftwarewillrespondtoexternaleventsorstimuli.Inthebehavioralmodeling,twodifferentcharacterizationsofstatesmustbeconsidered:thestateofeachclassasthesystemperformsitsfunctionthestateofthesystemasobservedfromtheoutsideasthesystemperformsitsfunctionThestateofaclasstakesonbothpassiveandactivecharacteristics.Apassivestateisthecurrentstatusofallofanobject’sattributes.Theactivestateofanobjectindicatesthecurrentstatusoftheobjectasitundergoesacontinuingtransformation.28TheStatesofaSystemstate—asetofobservablecircumstancesthatcharacterizesthebehaviorofasystematagiventimestatetransition—themovementfromonestatetoanotherevent—anoccurrencethatcausesthesystemtoexhibitsomepredictableformofbehavioraction—processthatoccursasaconsequenceofmakingatransition29StateDiagramExample-Elevator30BehavioralModeling&SequenceDiagrammakealistofthedifferentstatesofasystem(Howdo
本文标题:软件工程-实践者的研究方法(6)
链接地址:https://www.777doc.com/doc-212977 .html