




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
面向對象的分析與設計簡介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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年傳統工藝與文化研究考試試題及答案
- 勞動教育進入初中課堂的現狀與優化分析
- 醫療器械供應協議合同
- 人力資源招聘流程專業證明(8篇)
- 某中學學生課外活動安全制度
- 旅游管理案例分析試卷集
- 出生日期核實證明及長期工作履歷詳實記錄(7篇)
- 酒店業供應鏈管理服務協議
- 農村現代農業種植合作項目協議
- 2025多媒體應用設計師考試多媒體技術教育創新試題
- 山東師范大學附屬小學教師公開招聘32名模擬試卷【共500題附答案解析】
- 輸電線路巡視工作課件
- 思想政治教育畢業論文開題報告一覽
- 毒蛇咬傷應急演練方案
- 渣土倒運土票
- 劍橋少兒英語一級試題及答案
- 303093 池國華 《內部控制與風險管理(第3版)》思考題和案例分析答案
- 沈陽市生產性服務業調研報告
- 連續壓機生產刨花板熱壓質量控制初探.pdf
- C語言程序設計-實驗第一次上機實驗報告
- 標識標牌的制作與安裝
評論
0/150
提交評論