您好,欢迎访问三七文档
当前位置:首页 > 金融/证券 > 金融资料 > OO方法、RUP与UML建模讲义
OO方法、RUP与UML建模首席软件专家张恂博讯科技(上海)有限公司浩方科技集团2000.11主要内容一、OOAD与UML表示法二、RUP建模过程与步骤三、讨论一、OOAD与UML表示法OO原则•Abstraction(抽象)•Encapsulation(封装)•Modularity(模块化)•Hierarchy(分层)OO三要素•封装•继承•多态OO基本概念•对象•类•属性•操作(方法)•接口(多态)*•构件*•关系•包•子系统*接口与多态•Polymorphism:Theabilitytohidemanydifferentimplementationsbehindasingleinterface.•Interfacesformalizepolymorphism,support“plug-and-play”architectures.接口与多态ShapeTubePyramidCubeShapeDraw()Move()Scale()Rotate()InterfaceTubePyramidCubeComponent•Anon-trivial,nearlyindependent,andreplaceablepartofasystemthatfulfillsaclearfunctioninthecontextofawell-definedarchitecture.•sourcecodecomponent,runtimecomponents,executablecomponentSubsystem•Acombinationofapackage(cancontainothermodelelements)andaclass(hasbehavior)•Realizesoneormoreinterfaceswhichdefineitsbehavior.SubsystemNamesubsystemInterfaceOOAD是主流技术OOAD大部分情况下比结构化设计好:结构化设计是过时的东西,它强调软件的结构按照功能来组织,一旦功能改变,软件的结构就会不稳定。而OO设计把数据流和功能统一起来,IT行业绝大部分(70-80%)的软件设计(包括数据库设计)可以采用OO方法,目前国外流行的趋势也是这样,剩下的少部分有特定需求的可能还会用传统方法。另外在电信界,用有限自动状态机的SDL方法仍占绝大数,但现在UML和SDL出现了融合的趋势。ObjectOrientedAnalysis•用面向对象方法分析问题域,建立基于对象、消息的业务模型,形成对客观世界和业务本身的正确认识。•生成业务对象的动、静态模型和抽象类。ObjectOrientedDesign•针对OOA给出的问题域模型,用面向对象方法设计出软件基础架构(概要设计)和完整的类结构(详细设计),以实现业务功能。•生成对象类的动、静态模型(解决域)。Analysisvs.Design•Analysis–Focusonunderstandingtheproblem–Idealizeddesign–Behavior–SystemStructure–Functionalrequirements–Asmallmodel•Design–Focusonunderstandingthesolution–OperationsandAttributes–Performance–Closetorealcode–Objectlifecycles–Non-functionalrequirements–Alargemodel“4+1”视图•UseCaseView(End-user:Functionality)•LogicalView(Analysts/Designers:Structure)•ProcessView(Systemintegrators:Performance,Scalability,Throughput)•ImplementationView(Programmers:Softwaremanagement)•DeploymentView(Systemengineering:SystemTopology,Delivery,installation,communication)UML图示•UseCaseDiagram•SequenceDiagram•ClassDiagram•CollaborationDigram•StateDiagram•ActivityDiagram•ComponentDiagram•DeploymentDiagramActor-用户•“AnActordefinesacoherentsetofrolesthatusersofusecasesplaywheninteractingwithusecases.Anactorhasoneroleforeachusecasewithwhichitcommunicates.”•角色的集合,可以是人或外部系统。•定义了“系统边界”。ActorUseCase-用例•Thespecificationofasequenceofactions,includingvariants,thatasystem(orotherentity)canperform,interactingwithactorsofthesystem.•Ausecaseisacoherentunitoffunctionalityprovidedbyasystem,asubsystem,oraclassasmanifestedbysequencesofmessagesexchangedamongthesystemandoneormoreoutsideinteractors(calledactors)togetherwithactionsperformedbythesystem.UseCaseBusinessUseCase/ActorBusinessActorBusinessUseCaseBusiness-System•例子登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登includeincludeinclude课程登记系统登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登登UseCase依赖关系•Association–Theparticipationofanactorinausecase,i.e.instancesoftheactorandinstancesoftheusecasecommunicatewitheachother.Thisistheonlyrelationshipbetweenactorsandusecases.•Extend–AnextendrelationshipfromusecaseAtousecaseBindicatesthataninstanceofusecaseBmaybeextended(subjecttospecificconditionsspecifiedintheextension)bythebehaviorspecifiedbyA.ThebehaviorisinsertedatthelocationdefinedbytheextensionpointinBwhichisreferencedbytheextendrelationship.UseCase依赖关系•Generalization–AgeneralizationfromusecaseAtousecaseBindicatesthatAisaspecializationofB.•Include–AnincluderelationshipfromusecaseAtousecaseBindicatesthataninstanceoftheusecaseAwillalsoincludethebehaviorasspecifiedbyB.ThebehaviorisincludedatthelocationwhichdefinedinA.登登登登登登登登登登登登登登登登登登登登登登登登登登includeincludeincludeextend产品定购管理ActorGeneralization登登登登登登登登登登登登登登登SequenceDiagramAdiagramthatshowsobjectinteractionsarrangedintimesequence.Inparticular,itshowstheobjectsparticipatingintheinteractionandthesequenceofmessagesexchanged.Unlikeacollaborationdiagram,asequencediagramincludestimesequencesbutdoesnotincludeobjectrelationships.Asequencediagramcanexistinagenericform(describesallpossiblescenarios)andinaninstanceform(describesoneactualscenario).Sequencediagramsandcollaborationdiagramsexpresssimilarinformation,butshowitindifferentways.序列图元素Joe:CustomerBankingScreen:AccountFormUseCase描述•简述:ThisusecaseallowsaStudenttoregisterforcourseofferinginthecurrentsemester.TheStudentcanalsoupdateordeletecourseselectionsifchangesaremadewithintheadd/dropperiodatthebeginningofthesemester.TheCourseCatalogSystemprovidesalistofallthecourseofferingsforthecurrentsemester.登登登登事件流BasicFlow:ThisusecasestartwhenaStudentwishestoregisterforcourseofferings,ortochangehis/herexistingcourseschedule.1.ThesystemrequeststhattheStudentspecifythefunctionhe/shewouldliketoperform(eitherCreateaSchedule,UpdateaSchedule,orDeleteaSchedule).2.OncetheStudentprovidestherequestedinformation,oneofthesubflowsisexecuted.IftheRegistrarselected“CreateaSchedule”,theCreateaSchedulesubflowisexecuted.(UpdateaSchedule,DeleteaSchedule)CreateaSchedule1.ThesystemretrievesalistofavailablecourseofferingsfromtheCourseCatalogSystemanddisplaysthelisttotheStudent.2.TheStudentselects4primarycourseofferingsand2alternatecourseofferingsfromthelistofavailableofferings.3.Oncethestudenthasmadehis/herselections,thesystemcreate
本文标题:OO方法、RUP与UML建模讲义
链接地址:https://www.777doc.com/doc-4556705 .html