面向对象的分析与设计简介汇总课件

PPT
  • 阅读 37 次
  • 下载 0 次
  • 页数 68 页
  • 大小 2.582 MB
  • 2022-11-24 上传
  • 收藏
  • 违规举报
  • © 版权认领
下载文档30.00 元 加入VIP免费下载
此文档由【小橙橙】提供上传,收益归文档提供者,本网站只提供存储服务。若此文档侵犯了您的版权,欢迎进行违规举报版权认领
面向对象的分析与设计简介汇总课件
可在后台配置第一页与第二页中间广告代码
面向对象的分析与设计简介汇总课件
可在后台配置第二页与第三页中间广告代码
面向对象的分析与设计简介汇总课件
可在后台配置第三页与第四页中间广告代码
面向对象的分析与设计简介汇总课件
面向对象的分析与设计简介汇总课件
还剩10页未读,继续阅读
【这是免费文档,您可以免费阅读】
/ 68
  • 收藏
  • 违规举报
  • © 版权认领
下载文档30.00 元 加入VIP免费下载
文本内容

【文档说明】面向对象的分析与设计简介汇总课件.ppt,共(68)页,2.582 MB,由小橙橙上传

转载请保留链接:https://www.ichengzhen.cn/view-44874.html

以下为本文档部分文字说明:

面向对象的分析与设计简介OOA&OOD:Anintroduction2022/11/24InstituteofComputerSoftwareNanjingUniversity1摘要引言如何发现“类”如何设计“类”小结2022/11/24InstituteofComputer

SoftwareNanjingUniversity2摘要引言如何发现“类”如何设计“类”小结2022/11/24InstituteofComputerSoftwareNanjingUniversity3面向对象软件工程2022/11/24Institu

teofComputerSoftwareNanjingUniversity4问题域需求分析总体设计详细设计计算机OOTOOPOODOOA问题域编程测试计算机自然语言自然语言分析与设计的鸿沟编程语言自然语言

面向对象的编程语言传统的软件工程方法面向对象的软件工程方法面向对象软件工程面向对象方法真正意义深远的目标是它适合于解决分析与设计期间的复杂性并实现分析与设计的复用。面向对象的开发不仅仅是编程,必须在整个软件

生命周期采用一种全新的方法:在软件开发过程所有阶段都运用面向对象的方法,将OOA,OOD,OOP,OOT有机地集成在一起,这样有利于系统的稳定性。2022/11/24InstituteofComputerSoft

wareNanjingUniversity5面向对象软件工程喷泉模型以用户需求为动力,以对象为驱动各阶段是相互迭代和无间隙的使用相同的描述方法和模型,使得软件生存期各阶段所使用的方法、技术具有高度的连续性。2022/11/24InstituteofComputerSoftw

areNanjingUniversity62022/11/24InstituteofComputerSoftwareNanjingUniversity7面向对象方法BoochCoad/YourdonOMT:对象模

型,功能模型,动态模型JacobsonUML三种基本活动识别类和对象描述对象和类之间的关系通过描述每个类的功能定义对象的行为面向对象方法RationalUnifiedProcess(RUP)

–Rational统一开发过程迭代式的增量开发用例驱动以软件体系结构为核心2022/11/24InstituteofComputerSoftwareNanjingUniversity8面向对象的分析与设计OO方法强调开发过程的连续性构造一系列不断精化的面向对象

的模型实际上目前大多倾向于采用迭代式开发类成为分析、设计和实现的基本单元核心问题:Howtofindtheclasses(不同层面的类)?Howtodesigntheclasses?2022/11/24I

nstituteofComputerSoftwareNanjingUniversity9推荐CraigLarman:ApplyingUMLandPatterns:AnIntroductiontoObject-OrientedAnalysisandD

esignandIterativeDevelopment2022/11/24InstituteofComputerSoftwareNanjingUniversity10面向对象分析OOA是软件开发过程中的问题定义阶段领域分析(DomainAnalysis):抽取和整理用户

需求并建立问题域精确模型的过程。以公共对象、类和框架等形式在特定应用领域中标识、分析和规约公共的可复用的软件成分的能力。抽象出目标系统的本质属性,建立问题领域模型。应用分析(ApplicationAnalysis):将领域分析建立起来的问题领域模型,用某种基于计算机系统的语言来表示。响应时间需

求、用户界面需求和数据安全等特殊的需求也都在这一层分解抽出。2022/11/24InstituteofComputerSoftwareNanjingUniversity11面向对象分析领域分析2022/11/24InstituteofCompute

rSoftwareNanjingUniversity12领域知识源领域分析模型领域分析技术文件专家建议已有应用客户考察目前/未来的需求类的分类复用标准功能模型领域语言2022/11/24InstituteofComputerSoftwareNa

njingUniversity13面向对象分析具体步骤2022/11/24InstituteofComputerSoftwareNanjingUniversity14获取用户基本需求标识类和对象定义类的结构和层次表示类(对象)间的关

系为对象行为建模常用用例来收集和描述用户的需求标识类及类的属性和服务描述系统的静态结构描述系统的动态行为2022/11/24InstituteofComputerSoftwareNanjingUniversity15需求分析Waterfall式开

发其需求分析一开始(其实是过早地)确定的features在最终产品中真正采用情况的比例RequirementchecklistFURPS+Functionalfeatures,capabilities,securityUsabili

tyhumanfactors,help,documentationReliabilityfrequencyoffailure,recoverability,predictabilityPerformanceresponsetim

es,throughput,accuracy,availability,resourceusage.Supportabilityadaptability,maintainability,internatio

nalization,configurability.“+”ImplementationInterfaceOperationsPackagingLegal2022/11/24InstituteofComputer

SoftwareNanjingUniversity16ClassificationFunctionalrequirements:behavior,features,capabilities,securi

tyUsabilityrequirements:humanfactors,help,documentation“Thefontonthedisplayshouldbereadablefrom5feet”2022/11/24Ins

tituteofComputerSoftwareNanjingUniversity17ClassificationReliabilityrequirements:frequencyoffailure,recoverabil

ityPerformancerequirements:responsetimes,throughput,accuracy,availability,resourceusage,etc.2022/11/24I

nstituteofComputerSoftwareNanjingUniversity18ClassificationSupportabilityrequirements:adaptability,inte

rnationalization,maintainability“Thesystemshouldallowfrequentandeasychangesinthenetworkconfiguration”The+in

theFURPS+:Implementationrequirements:“MustuseLinuxandJava”2022/11/24InstituteofComputerSoftwareNanjingUniver

sity19面向对象分析OOA模型2022/11/24InstituteofComputerSoftwareNanjingUniversity20基本模型(类图)对象层特征层关系层交互图主题图详细说明面向对象设计OOD是面向对象方法在软件设计阶段应用与扩展的结果,通常分为

两个阶段高层设计:建立应用的体系结构低层设计:集中于类的详细设计OOD的准则抽象,信息隐藏,模块化,弱耦合,强内聚,可重用2022/11/24InstituteofComputerSoftwareNanjingUniversity21面向对

象设计OOD具体内容按实现条件对OOA模型进行调整,并补充几个新的组成部分:设计问题域组元设计人机交互组元设计任务管理组元设计数据管理组元2022/11/24InstituteofComputerSoftwareNanji

ngUniversity22摘要引言如何发现“类”如何设计“类”小结2022/11/24InstituteofComputerSoftwareNanjingUniversity23回顾:三个世界ThreeworldsVisualmodeling2022/11/24Institu

teofComputerSoftwareNanjingUniversity242022/11/24InstituteofComputerSoftwareNanjingUniversity25现实世界问题世界软件世界Re

ality抽象问题:Howtofindtheclasses?Usecase基于需求文档Use-casemodel:writingrequirementsincontext2022/11/24Ins

tituteofComputerSoftwareNanjingUniversity26用例(UseCases)用例是一个叙述性文档,用来描述参与者使用系统完成某个过程时的事件发生顺序。用例乃是对过程的描述。过程描述事件、动作和事务处理自始至终的发生顺序。Use

casesaretextdocuments,notdiagrams,anduse-casemodelingisprimarilyanactofwritingtext,notdrawingdiagrams.2022/11/24InstituteofCompute

rSoftwareNanjingUniversity27UseCase例子:ProcessSale:Acustomerarrivesatacheckoutwithitemstopurchase.ThecashierusesthePOSsystemtorecordeachpurchas

editem.Thesystempresentsarunningtotalandline-itemdetails.Thecustomerenterspaymentinformation,whichthesystemvalidatesandrecords.Thesystemupdates

inventory.Thecustomerreceivesareceiptfromthesystemandthenleaveswiththeitems.2022/11/24InstituteofComputerSoftwar

eNanjingUniversity28Actor,Scenario,UseCase简单地说,anactorissomethingwithbehavior,suchasaperson(identifiedbyrol

e),computersystem,ororganization;forexample,acashier.Ascenarioisaspecificsequenceofactionsandinteractionsbetweenactorsandthesystem;itisals

ocalledausecaseinstance.Itisoneparticularstoryofusingasystem,oronepaththroughtheusecase;forexample,th

escenarioofsuccessfullypurchasingitemswithcash,orthescenariooffailingtopurchaseitemsbecauseofacreditpaymentdenia

l.ausecaseisacollectionofrelatedsuccessandfailurescenariosthatdescribeanactorusingasystemtosupportagoal.Forexample,hereisacasualformatus

ecasewithalternatescenarios:2022/11/24InstituteofComputerSoftwareNanjingUniversity29ProcessSale2022/11/24InstituteofComputerSoftwareNanjingUniversi

ty302022/11/24InstituteofComputerSoftwareNanjingUniversity31Actor有GoalIvarJacobson:Asetofuse-caseinstances,wheree

achinstanceisasequenceofactionsasystemperformsthatyieldsanobservableresultofvaluetoaparticularactor.软件工程师容易犯的错

误:自认为所做的是客户/用户需要的。不能代替客户/用户假想其价值所在。2022/11/24InstituteofComputerSoftwareNanjingUniversity32创建USECASE的一些原则用例可以

是一个场景,包括动作和交互。用例可以是一组场景,描述不同场景下的行为。这种书写格式可以在任何时候描述有变体的行为,例如黑盒需求,业务流程,系统设计说明。用例里不要有系统设计,用例里不要有界面设计,用例里

不要有特性列表,用例里不要有测试。用例应该描述行为需求。用例的主场景不要超过九步。可以在适当的层次上得到子目标和移除设计说明。用例的最大价值不在于主场景,而是在于备选行为。主场景可能只占用例长度的四分之一到十分之一。2022/11/24InstituteofComputerSoftwar

eNanjingUniversity33用例的识别界定系统边界基于参与者先识别参与者对每个参与者,找出其所发起和参与的过程基于事件识别系统必须响应的外部事件把事件与参与者和用例联系起来2022/

11/24InstituteofComputerSoftwareNanjingUniversity34边界,Actors,Goals2022/11/24InstituteofComputerSoftwareNanjingUniversity35识别Ac

tors及其Goals除了明显的Actors之外,还要问问诸如以下这些问题:Whostartsandstopsthesystem?Whodoessystemadministration?Whodoesuserandsecuritymanageme

nt?Is"time"anactorbecausethesystemdoessomethinginresponsetoatimeevent?Isthereamonitoringprocessthatrestartsthesystemifitfails?Whoevaluat

essystemactivityorperformance?Howaresoftwareupdateshandled?Pushorpullupdate?Whoevaluateslogs?Aretheyremotelyretrieved?Inadditiontohumanprimaryact

ors,arethereanyexternalsoftwareorroboticsystemsthatcalluponservicesofthesystem?Whogetsnotifiedwhenthereareerrorsorfailures?36Usec

asesfavorafunctionalapproach!“Also,nameusecasesstartingwithaverb.”NOTveryusefulinfindingclasses.But,usefulinunderstandingrequire

ments,validatingtheresultedmodelandimplementation.此外还要对照FURPS+检查其他需求2022/11/24InstituteofComputerSoftwareNanjingUniver

sity37Findtheclasses“Thenounsandtheverbs”启发:类与方法;但是“Theelevatorwillcloseitsdoorbeforeitmovestoanotherfloor.”有的名词不是类;有的类不表现为名词;基本原则:ADT

2022/11/24InstituteofComputerSoftwareNanjingUniversity38Findtheclasses没有机械的办法。基于经验的启发性、指导性的原则:哪些东西是可能的类;哪些形式的类不理想,可考虑从模型中去除;2

022/11/24InstituteofComputerSoftwareNanjingUniversity39Theidealclass明确的抽象类名是名词或形容词,刻画该抽象形容词常用于表达接口代表一系列运行时刻的对象。(允许特意的singleto

n)有修改操作(或作用式操作)形式或非形式地刻画性质:不变式前后臵断言2022/11/24InstituteofComputerSoftwareNanjingUniversity40三种类分析类直接对应于问题域设计类为

得到优雅的、可扩展的结构而引入实现类满足软件系统实现算法所需。如LinkedList;Array等2022/11/24InstituteofComputerSoftwareNanjingUniversit

y41分析类Analysisclassesrepresentanearlyconceptualmodelfor„thingsinthesystemwhichhaveresponsibilitiesandbehavior‟.Analysisclassesare

usedtocapturea„first-draft‟,rough-cutoftheobjectmodelofthesystem.Analysisclasseshandleprimarilyfunctionalrequirements.Theymodelo

bjectsfromtheproblemdomain.2022/11/24InstituteofComputerSoftwareNanjingUniversity42分析类Therearethreeaspectsofthesystemt

hatarelikelytochange:theboundarybetweenthesystemanditsactors(boundary)theinformationthesystemuses(entity)thecontrollogicofthesystem(control)2022/1

1/24InstituteofComputerSoftwareNanjingUniversity43behaviourinformationboundaryHeuristicsforfindingclasses寻找分析类OperationalMod

elofsomeaspectoftheexternalworld.SimulationButexternalclassescanbequiteabstract不一定是客观实体,也可能是抽象概念2022/11/24InstituteofComputerSoftwareNanjingUni

versity44Heuristicsforfindingclasses寻找实现类实现难多复用数据结构与算法知识延迟实现类如“Queue”类层次组织多种不同实现2022/11/24InstituteofComputerSoftwareNanjingUniver

sity45Heuristicsforfindingclasses寻找设计类创造性工作设计模式的用武之地其他途径旧系统Adaptationthroughinheritance2022/11/24InstituteofComputerSoftwareNanjingUnivers

ity462022/11/24InstituteofComputerSoftwareNanjingUniversity472022/11/24InstituteofComputerSoftwareNanjingUniver

sity482022/11/24InstituteofComputerSoftwareNanjingUniversity492022/11/24InstituteofComputerSoftwareNanjingUniversity50DomainMo

del领域模型Adomainmodelisarepresentationofreal-worldconceptualclassesnotarepresentationofsoftwarecomponents.notasetofdiagra

msdescribingsoftwareclasses,notsoftwareobjectswithresponsibilities.Adomainmodelisavisualrepresentationofconceptualcl

assesorreal-worldobjectsinadomainofinterest[MO95,Fowler96]Theyhavealsobeencalledconceptualmodels,domainobjectmodels,andanalysisobjectmodels

TheUPdefinesaDomainModelasoneoftheartifactsthatmaybecreatedintheBusinessModelingdiscipline.2022/11/24InstituteofComputerSoftwa

reNanjingUniversity51DomainModelUsingUMLnotation,adomainmodelisillustratedwithasetofclassdiagramsinwh

ichnooperationsaredefined.Itmayshow:domainobjectsorconceptualclassesassociationsbetweenconceptualclassesattributesofconceptualcla

sses2022/11/24InstituteofComputerSoftwareNanjingUniversity52>>Informally,aconceptualclassisanidea,thing,orobject.>>Moreformally,aconcept

ualclassmaybeconsideredintermsofitssymbol,intension,andextension[MO95].DomainModel2022/11/24InstituteofComputerSoftwareNanjin

gUniversity53DomainModelSoftwareproblemscanbecomplex;Decomposition(divide-and-conquer)isacommonstrategytodea

lwiththiscomplexitybydivisionoftheproblemspaceintocomprehensibleunits.Instructuredanalysis,thedimensionofdecom

positionisbyprocessesorfunctions.However,inobject-orientedanalysis,thedimensionofdecompositionisfundamentallybythingsorentitiesinthedomain.A

centraldistinctionbetweenobject-orientedandstructuredanalysisis:divisionbyconceptualclasses(objects)ratherthandivision

byfunctions.Aprimaryanalysistaskistoidentifydifferentconceptsintheproblemdomainanddocumenttheresultsinadomainmodel2022/11/24InstituteofComputerSoftw

areNanjingUniversity54SystemSequenceDiagrams识别系统事件定义系统操作给出这些操作的Contracts2022/11/24InstituteofComputerSoftwareNanjingUniversity552022/1

1/24InstituteofComputerSoftwareNanjingUniversity57ContractCO2:enterItemOperation:enterItem(itemID:ItemID,quantity:integer)Cr

ossReferences:UseCases:ProcessSalePreconditions:Thereisasaleunderway.Postconditions:-ASalesLineIteminstancesliwascreated(insta

ncecreation).-sliwasassociatedwiththecurrentSale(associationformed).-sli.quantitybecamequantity(attributemodification)

.-sliwasassociatedwithaProductDescription,basedonitemIDmatch(associationformed).接下来建立系统类模型类图在类之间分配职责202

2/11/24InstituteofComputerSoftwareNanjingUniversity58摘要引言如何发现“类”如何设计“类”小结2022/11/24InstituteofComputerSoftwareNanjingUniversity59C

lassDesignOO设计是一个迭代的过程!把分析类直接带入设计阶段如果在设计阶段合并了分析模型,那么在演化的时候,保持分析和设计模型的一致性会更容易类设计:增加细节和执行精细决策2022/11/24InstituteofCompu

terSoftwareNanjingUniversity60ClassDesign填补从高层需求到低层服务之间的空白用操作实现用例阐述每个操作的算法选择算法;数据结构;设计内部类和操作向下递归到支持更高层操作的设计操作功能分层;机制分层把模型重构成更简洁的设计2022/11/2

4InstituteofComputerSoftwareNanjingUniversity61ClassDesign优化数据的访问路径效率问题具体化必须操作的行为Command,Strategy模式调整类的结构以增加继承重新调整

类和操作;提取公共行为;使用委托来共享行为组织类和关联信息隐藏;内聚性;微调包2022/11/24InstituteofComputerSoftwareNanjingUniversity62ClassDesign创

建初始设计类定义操作定义方法定义状态定义属性定义依赖定义关联2022/11/24InstituteofComputerSoftwareNanjingUniversity63HowManyClassesAre

Needed?大部分,简单的类意味着每一个类封装较少的整个系统的智能更易被复用更易实现少部分,复杂的类意味着每个类封装较多的整个系统的智能不太会被复用更难实现2022/11/24InstituteofComputerSoftw

areNanjingUniversity64Aclassshouldhaveasinglewellfocusedpurpose.Aclassshoulddoonethinganddoitwell!小结面向对象分析和设计特点,过程,任务如何发现类用例领域模型如何设计类20

22/11/24InstituteofComputerSoftwareNanjingUniversity652022/11/24InstituteofComputerSoftwareNanjingUniversity66UML-Books2022/11/24Institu

teofComputerSoftwareNanjingUniversity67UML-Tools?作业(本次作业不用提交)复习UML,学习使用一种UML工具2022/11/24InstituteofComputerSoftwareNanjingUn

iversity68

小橙橙
小橙橙
文档分享,欢迎浏览!
  • 文档 25747
  • 被下载 7
  • 被收藏 0
相关资源
广告代码123
若发现您的权益受到侵害,请立即联系客服,我们会尽快为您处理。侵权客服QQ:395972555 (支持时间:9:00-21:00) 公众号
Powered by 太赞文库
×
确认删除?