




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
面向对象的分析与设计简介OOA&OOD:Anintroduction2023/9/1InstituteofComputerSoftwareNanjingUniversity1OOA&OOD:Anintroduction2023摘要引言如何发现“类”如何设计“类”小结2023/9/1InstituteofComputerSoftwareNanjingUniversity2摘要引言2023/8/2InstituteofCompu摘要引言如何发现“类”如何设计“类”小结2023/9/1InstituteofComputerSoftwareNanjingUniversity3摘要引言2023/8/2InstituteofCompu面向对象软件工程2023/9/1InstituteofComputerSoftwareNanjingUniversity4问题域需求分析总体设计详细设计计算机OOTOOPOODOOA问题域编程测试计算机自然语言自然语言分析与设计的鸿沟编程语言自然语言面向对象的编程语言传统的软件工程方法面向对象的软件工程方法面向对象软件工程2023/8/2InstituteofC面向对象软件工程面向对象方法真正意义深远的目标是它适合于解决分析与设计期间的复杂性并实现分析与设计的复用。面向对象的开发不仅仅是编程,必须在整个软件生命周期采用一种全新的方法:在软件开发过程所有阶段都运用面向对象的方法,将OOA,OOD,OOP,OOT有机地集成在一起,这样有利于系统的稳定性。2023/9/1InstituteofComputerSoftwareNanjingUniversity5面向对象软件工程面向对象方法真正意义深远的目标是它适合于解决面向对象软件工程喷泉模型以用户需求为动力,以对象为驱动各阶段是相互迭代和无间隙的使用相同的描述方法和模型,使得软件生存期各阶段所使用的方法、技术具有高度的连续性。2023/9/1InstituteofComputerSoftwareNanjingUniversity6面向对象软件工程喷泉模型2023/8/2Institute2023/9/1InstituteofComputerSoftwareNanjingUniversity7面向对象方法BoochCoad/YourdonOMT:对象模型,功能模型,动态模型JacobsonUML三种基本活动识别类和对象描述对象和类之间的关系通过描述每个类的功能定义对象的行为2023/8/2InstituteofComputer面向对象方法RationalUnifiedProcess(RUP)–Rational统一开发过程迭代式的增量开发用例驱动以软件体系结构为核心2023/9/1InstituteofComputerSoftwareNanjingUniversity8面向对象方法RationalUnifiedProcess面向对象的分析与设计OO方法强调开发过程的连续性构造一系列不断精化的面向对象的模型实际上目前大多倾向于采用迭代式开发类成为分析、设计和实现的基本单元核心问题:Howtofindtheclasses(不同层面的类)?Howtodesigntheclasses?2023/9/1InstituteofComputerSoftwareNanjingUniversity9面向对象的分析与设计OO方法强调开发过程的连续性2023/8推荐Craig
Larman:ApplyingUMLandPatterns:AnIntroductiontoObject-OrientedAnalysisandDesignandIterativeDevelopment
2023/9/1InstituteofComputerSoftwareNanjingUniversity10推荐Craig
Larman:ApplyingUML面向对象分析OOA是软件开发过程中的问题定义阶段领域分析(DomainAnalysis):抽取和整理用户需求并建立问题域精确模型的过程。以公共对象、类和框架等形式在特定应用领域中标识、分析和规约公共的可复用的软件成分的能力。抽象出目标系统的本质属性,建立问题领域模型。应用分析(ApplicationAnalysis):将领域分析建立起来的问题领域模型,用某种基于计算机系统的语言来表示。响应时间需求、用户界面需求和数据安全等特殊的需求也都在这一层分解抽出。2023/9/1InstituteofComputerSoftwareNanjingUniversity11面向对象分析OOA是软件开发过程中的问题定义阶段2023/8面向对象分析领域分析2023/9/1InstituteofComputerSoftwareNanjingUniversity12领域知识源领域分析模型领域分析技术文件专家建议已有应用客户考察目前/未来的需求类的分类复用标准功能模型领域语言面向对象分析领域分析2023/8/2Instituteof2023/9/1InstituteofComputerSoftwareNanjingUniversity132023/8/2InstituteofComputer面向对象分析具体步骤2023/9/1InstituteofComputerSoftwareNanjingUniversity14获取用户基本需求标识类和对象定义类的结构和层次表示类(对象)间的关系为对象行为建模常用用例来收集和描述用户的需求标识类及类的属性和服务描述系统的静态结构描述系统的动态行为面向对象分析具体步骤2023/8/2Instituteof2023/9/1InstituteofComputerSoftwareNanjingUniversity15需求分析Waterfall式开发其需求分析一开始(其实是过早地)确定的features在最终产品中真正采用情况的比例2023/8/2InstituteofComputerRequirementchecklistFURPS+Functionalfeatures,capabilities,securityUsabilityhumanfactors,help,documentationReliabilityfrequencyoffailure,recoverability,predictabilityPerformanceresponsetimes,throughput,accuracy,availability,resourceusage.Supportabilityadaptability,maintainability,internationalization,configurability.“+”ImplementationInterfaceOperationsPackagingLegal2023/9/1InstituteofComputerSoftwareNanjingUniversity16RequirementchecklistFURPS+202ClassificationFunctionalrequirements:behavior,features,capabilities,securityUsabilityrequirements:humanfactors,help,documentation“Thefontonthedisplayshouldbereadablefrom5feet”2023/9/1InstituteofComputerSoftwareNanjingUniversity17ClassificationFunctionalrequiClassificationReliabilityrequirements:frequencyoffailure,recoverabilityPerformancerequirements:responsetimes,throughput,accuracy,availability,resourceusage,etc.2023/9/1InstituteofComputerSoftwareNanjingUniversity18ClassificationReliabilityrequClassificationSupportabilityrequirements:adaptability,internationalization,maintainability“Thesystemshouldallowfrequentandeasychangesinthenetworkconfiguration”The+intheFURPS+:Implementationrequirements:“MustuseLinuxandJava”2023/9/1InstituteofComputerSoftwareNanjingUniversity19ClassificationSupportabilityr面向对象分析OOA模型2023/9/1InstituteofComputerSoftwareNanjingUniversity20基本模型(类图)对象层特征层关系层交互图主题图详细说明面向对象分析OOA模型2023/8/2Instituteo面向对象设计OOD是面向对象方法在软件设计阶段应用与扩展的结果,通常分为两个阶段高层设计:建立应用的体系结构低层设计:集中于类的详细设计OOD的准则抽象,信息隐藏,模块化,弱耦合,强内聚,可重用2023/9/1InstituteofComputerSoftwareNanjingUniversity21面向对象设计OOD是面向对象方法在软件设计阶段应用与扩展的结面向对象设计OOD具体内容按实现条件对OOA模型进行调整,并补充几个新的组成部分:设计问题域组元设计人机交互组元设计任务管理组元设计数据管理组元2023/9/1InstituteofComputerSoftwareNanjingUniversity22面向对象设计OOD具体内容2023/8/2Institute摘要引言如何发现“类”如何设计“类”小结2023/9/1InstituteofComputerSoftwareNanjingUniversity23摘要引言2023/8/2InstituteofCompu回顾:三个世界ThreeworldsVisualmodeling2023/9/1InstituteofComputerSoftwareNanjingUniversity24回顾:三个世界Threeworlds2023/8/2Ins2023/9/1InstituteofComputerSoftwareNanjingUniversity25现实世界问题世界软件世界Reality抽象2023/8/2InstituteofComputer问题:Howtofindtheclasses?Usecase基于需求文档Use-casemodel:writingrequirementsincontext2023/9/1InstituteofComputerSoftwareNanjingUniversity26问题:Howtofindtheclasses?Use用例(UseCases)用例是一个叙述性文档,用来描述参与者使用系统完成某个过程时的事件发生顺序。用例乃是对过程的描述。过程描述事件、动作和事务处理自始至终的发生顺序。Usecasesaretextdocuments,notdiagrams,anduse-casemodelingisprimarilyanactofwritingtext,notdrawingdiagrams.2023/9/1InstituteofComputerSoftwareNanjingUniversity27用例(UseCases)用例是一个叙述性文档,用来描述参与UseCase例子:ProcessSale:Acustomerarrivesatacheckoutwithitemstopurchase.ThecashierusesthePOSsystemtorecordeachpurchaseditem.Thesystempresentsarunningtotalandline-itemdetails.Thecustomerenterspaymentinformation,whichthesystemvalidatesandrecords.Thesystemupdatesinventory.Thecustomerreceivesareceiptfromthesystemandthenleaveswiththeitems.2023/9/1InstituteofComputerSoftwareNanjingUniversity28UseCase例子:ProcessSale:2023/Actor,Scenario,UseCase简单地说,anactorissomethingwithbehavior,suchasaperson(identifiedbyrole),computersystem,ororganization;forexample,acashier.Ascenarioisaspecificsequenceofactionsandinteractionsbetweenactorsandthesystem;itisalsocalledausecaseinstance.Itisoneparticularstoryofusingasystem,oronepaththroughtheusecase;forexample,thescenarioofsuccessfullypurchasingitemswithcash,orthescenariooffailingtopurchaseitemsbecauseofacreditpaymentdenial.ausecaseisacollectionofrelatedsuccessandfailurescenariosthatdescribeanactorusingasystemtosupportagoal.Forexample,hereisacasualformatusecasewithalternatescenarios:2023/9/1InstituteofComputerSoftwareNanjingUniversity29Actor,Scenario,UseCase简单地说,ProcessSale2023/9/1InstituteofComputerSoftwareNanjingUniversity30ProcessSale2023/8/2Institute2023/9/1InstituteofComputerSoftwareNanjingUniversity312023/8/2InstituteofComputerActor有GoalIvarJacobson:Asetofuse-caseinstances,whereeachinstanceisasequenceofactionsasystemperformsthat
yieldsanobservableresultofvaluetoaparticularactor.软件工程师容易犯的错误:自认为所做的是客户/
用户需要的。不能代替客户/用户假想其价值所在。2023/9/1InstituteofComputerSoftwareNanjingUniversity32Actor有GoalIvarJacobson:Aset创建USECASE的一些原则用例可以是一个场景,包括动作和交互。用例可以是一组场景,描述不同场景下的行为。这种书写格式可以在任何时候描述有变体的行为,例如黑盒需求,业务流程,系统设计说明。
用例里不要有系统设计,用例里不要有界面设计,用例里不要有特性列表,用例里不要有测试。用例应该描述行为需求。用例的主场景不要超过九步。可以在适当的层次上得到子目标和移除设计说明。用例的最大价值不在于主场景,而是在于备选行为。主场景可能只占用例长度的四分之一到十分之一。2023/9/1InstituteofComputerSoftwareNanjingUniversity33创建USECASE的一些原则用例可以是一个场景,包括动作和用例的识别界定系统边界基于参与者先识别参与者对每个参与者,找出其所发起和参与的过程基于事件识别系统必须响应的外部事件把事件与参与者和用例联系起来2023/9/1InstituteofComputerSoftwareNanjingUniversity34用例的识别界定系统边界2023/8/2Instituteo边界,Actors,Goals2023/9/1InstituteofComputerSoftwareNanjingUniversity35边界,Actors,Goals2023/8/2Institu识别Actors及其Goals除了明显的Actors之外,还要问问诸如以下这些问题:Whostartsandstopsthesystem?Whodoessystemadministration?Whodoesuserandsecuritymanagement?Is"time"anactorbecausethesystemdoessomethinginresponsetoatimeevent?Isthereamonitoringprocessthatrestartsthesystemifitfails?Whoevaluatessystemactivityorperformance?Howaresoftwareupdateshandled?Pushorpullupdate?Whoevaluateslogs?Aretheyremotelyretrieved?Inadditiontohumanprimaryactors,arethereanyexternalsoftwareorroboticsystemsthatcalluponservicesofthesystem?Whogetsnotifiedwhenthereareerrorsorfailures?36识别Actors及其Goals除了明显的Actors之外,还Usecasesfavorafunctionalapproach!“Also,nameusecasesstartingwithaverb.”NOTveryusefulinfindingclasses.But,usefulinunderstandingrequirements,validatingtheresultedmodelandimplementation.此外还要对照FURPS+检查其他需求2023/9/1InstituteofComputerSoftwareNanjingUniversity37UsecasesfavorafunctionalaFindtheclasses“Thenounsandtheverbs”启发:类与方法;但是“Theelevatorwillcloseitsdoorbeforeitmovestoanotherfloor.”有的名词不是类;有的类不表现为名词;基本原则:ADT2023/9/1InstituteofComputerSoftwareNanjingUniversity38Findtheclasses“ThenounsandFindtheclasses没有机械的办法。基于经验的启发性、指导性的原则:哪些东西是可能的类;哪些形式的类不理想,可考虑从模型中去除;2023/9/1InstituteofComputerSoftwareNanjingUniversity39Findtheclasses没有机械的办法。2023/8Theidealclass明确的抽象类名是名词或形容词,刻画该抽象形容词常用于表达接口代表一系列运行时刻的对象。(允许特意的singleton)有修改操作(或作用式操作)形式或非形式地刻画性质:不变式前后置断言2023/9/1InstituteofComputerSoftwareNanjingUniversity40Theidealclass明确的抽象2023/8/2In三种类分析类直接对应于问题域设计类为得到优雅的、可扩展的结构而引入实现类满足软件系统实现算法所需。如LinkedList;Array等2023/9/1InstituteofComputerSoftwareNanjingUniversity41三种类分析类2023/8/2InstituteofCo分析类Analysisclassesrepresentanearlyconceptualmodelfor‘thingsinthesystemwhichhaveresponsibilitiesandbehavior’.Analysisclassesareusedtocapturea‘first-draft’,rough-cutoftheobjectmodelofthesystem.Analysisclasseshandleprimarilyfunctionalrequirements.Theymodelobjectsfromtheproblemdomain.2023/9/1InstituteofComputerSoftwareNanjingUniversity42分析类Analysisclassesrepresent分析类Therearethreeaspectsofthesystemthatarelikelytochange:
theboundarybetweenthesystemanditsactors(boundary)theinformationthesystemuses(entity)thecontrollogicofthesystem(control)2023/9/1InstituteofComputerSoftwareNanjingUniversity43behaviourinformationboundary分析类TherearethreeaspectsofHeuristicsforfindingclasses寻找分析类OperationalModelofsomeaspectoftheexternalworld.SimulationButexternalclassescanbequiteabstract不一定是客观实体,也可能是抽象概念2023/9/1InstituteofComputerSoftwareNanjingUniversity44HeuristicsforfindingclassesHeuristicsforfindingclasses寻找实现类实现难多复用数据结构与算法知识延迟实现类如“Queue”类层次组织多种不同实现2023/9/1InstituteofComputerSoftwareNanjingUniversity45HeuristicsforfindingclassesHeuristicsforfindingclasses寻找设计类创造性工作设计模式的用武之地其他途径旧系统Adaptationthroughinheritance2023/9/1InstituteofComputerSoftwareNanjingUniversity46Heuristicsforfindingclasses2023/9/1InstituteofComputerSoftwareNanjingUniversity472023/8/2InstituteofComputer2023/9/1InstituteofComputerSoftwareNanjingUniversity482023/8/2InstituteofComputer2023/9/1InstituteofComputerSoftwareNanjingUniversity492023/8/2InstituteofComputer2023/9/1InstituteofComputerSoftwareNanjingUniversity502023/8/2InstituteofComputerDomainModel领域模型Adomainmodelisarepresentationofreal-worldconceptualclasses
notarepresentationofsoftwarecomponents.notasetofdiagramsdescribingsoftwareclasses,notsoftwareobjectswithresponsibilities.Adomainmodelisavisualrepresentationofconceptualclassesorreal-worldobjectsinadomainofinterest[MO95,Fowler96]Theyhavealsobeencalledconceptualmodels,domainobjectmodels,andanalysisobjectmodelsTheUPdefinesaDomainModelasoneoftheartifactsthatmaybecreatedintheBusinessModelingdiscipline.2023/9/1InstituteofComputerSoftwareNanjingUniversity51DomainModel领域模型AdomainmodeDomainModelUsingUMLnotation,adomainmodelisillustratedwithasetofclassdiagrams
inwhichnooperationsaredefined.Itmayshow:domainobjectsorconceptualclassesassociationsbetweenconceptualclassesattributesofconceptualclasses2023/9/1InstituteofComputerSoftwareNanjingUniversity52>>Informally,aconceptualclassisanidea,thing,orobject.>>Moreformally,aconceptualclassmaybeconsideredintermsofitssymbol,intension,andextension[MO95].DomainModelUsingUMLnotationDomainModel2023/9/1InstituteofComputerSoftwareNanjingUniversity53DomainModel2023/8/2InstituteDomainModelSoftwareproblemscanbecomplex;Decomposition(divide-and-conquer)isacommonstrategytodealwiththiscomplexitybydivisionoftheproblemspaceintocomprehensibleunits.Instructuredanalysis,thedimensionofdecompositionisbyprocessesorfunctions.However,inobject-orientedanalysis,thedimensionofdecompositionisfundamentallybythingsorentitiesinthedomain.Acentraldistinctionbetweenobject-orientedandstructuredanalysisis:divisionbyconceptualclasses(objects)ratherthandivisionbyfunctions.Aprimaryanalysistaskistoidentifydifferentconceptsintheproblemdomainanddocumenttheresultsinadomainmodel2023/9/1InstituteofComputerSoftwareNanjingUniversity54DomainModelSoftwareproblemsSystemSequenceDiagrams识别系统事件定义系统操作给出这些操作的Contracts2023/9/1InstituteofComputerSoftwareNanjingUniversity55SystemSequenceDiagrams识别系统事件面向对象的分析与设计简介课件2023/9/1InstituteofComputerSoftwareNanjingUniversity57ContractCO2:enterItemOperation:enterItem(itemID:ItemID,quantity:integer)CrossReferences:UseCases:ProcessSalePreconditions:Thereisasaleunderway.Postconditions:-ASalesLineIteminstancesliwascreated(instancecreation).-sliwasassociatedwiththecurrentSale(associationformed).-sli.quantitybecamequantity(attributemodification).-sliwasassociatedwithaProductDescription,basedonitemIDmatch(associationformed).2023/8/2InstituteofComputer接下来建立系统类模型类图在类之间分配职责2023/9/1InstituteofComputerSoftwareNanjingUniversity58接下来建立系统类模型类图2023/8/2Institute摘要引言如何发现“类”如何设计“类”小结2
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- HY/T 0465-2024红树林修复与利用地埋管网系统技术指南
- java线程变量面试题及答案
- 电子产品测试面试题及答案
- 材料力学基本知识试题及答案
- 软考网络工程师历史试题及答案回顾2025年
- 项目管理与业务战略的结合试题及答案
- 机电工程项目实施过程管理试题及答案
- 软考网络工程师备考技巧与试题及答案
- 挖掘网络工程师的潜在机会与试题及答案
- 网络工程师考生经验分享试题及答案
- 2024土地代耕代种协议书
- 《水电工程岩爆风险评估技术规范》(NB-T 10143-2019)
- 预防术中低体温Pdca 课件
- 胃癌诊疗指南(2022年版)
- 医院物业人员交接方案
- 建筑施工行业应急管理体系建设
- 逆变器技术规范书
- 【要填报的表格】园林行政许可申请表-树木砍伐、移栽、修剪(洪山园林局专用)
- 传染病管理工作流程图预防医学、卫生学
- 特种作业人员体检表
- 精益改善周五阶段
评论
0/150
提交评论