面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介_第1頁
面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介_第2頁
面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介_第3頁
面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介_第4頁
面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介_第5頁
已閱讀5頁,還剩61頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

面向?qū)ο蟮姆治雠c設(shè)計(jì)方案簡介2摘要引言如何發(fā)現(xiàn)“類”如何設(shè)計(jì)“類”小結(jié)3摘要引言如何發(fā)現(xiàn)“類”如何設(shè)計(jì)“類”小結(jié)4面向?qū)ο筌浖こ虇栴}域需求分析總體設(shè)計(jì)詳細(xì)設(shè)計(jì)計(jì)算機(jī)OOTOOPOODOOA問題域編程測試計(jì)算機(jī)自然語言自然語言分析與設(shè)計(jì)的鴻溝編程語言自然語言面向?qū)ο蟮木幊陶Z言傳統(tǒng)的軟件工程方法面向?qū)ο蟮能浖こ谭椒?面向?qū)ο筌浖こ堂嫦驅(qū)ο蠓椒ㄕ嬲饬x深遠(yuǎn)的目標(biāo)是它適合于解決分析與設(shè)計(jì)期間的復(fù)雜性并實(shí)現(xiàn)分析與設(shè)計(jì)的復(fù)用。面向?qū)ο蟮拈_發(fā)不僅僅是編程,必須在整個(gè)軟件生命周期采用一種全新的方法:在軟件開發(fā)過程所有階段都運(yùn)用面向?qū)ο蟮姆椒?,將OOA,OOD,OOP,OOT有機(jī)地集成在一起,這樣有利于系統(tǒng)的穩(wěn)定性。6面向?qū)ο筌浖こ虈娙P鸵杂脩粜枨鬄閯?dòng)力,以對象為驅(qū)動(dòng)各階段是相互迭代和無間隙的使用相同的描述方法和模型,使得軟件生存期各階段所使用的方法、技術(shù)具有高度的連續(xù)性。7面向?qū)ο蠓椒˙oochCoad/YourdonOMT:對象模型,功能模型,動(dòng)態(tài)模型JacobsonUML三種基本活動(dòng)識(shí)別類和對象描述對象和類之間的關(guān)系通過描述每個(gè)類的功能定義對象的行為8面向?qū)ο蠓椒≧ationalUnifiedProcess(RUP)–Rational統(tǒng)一開發(fā)過程迭代式的增量開發(fā)用例驅(qū)動(dòng)以軟件體系結(jié)構(gòu)為核心9面向?qū)ο蟮姆治雠c設(shè)計(jì)OO方法強(qiáng)調(diào)開發(fā)過程的連續(xù)性構(gòu)造一系列不斷精化的面向?qū)ο蟮哪P蛯?shí)際上目前大多傾向于采用迭代式開發(fā)類成為分析、設(shè)計(jì)和實(shí)現(xiàn)的基本單元核心問題:Howtofindtheclasses(不同層面的類)?Howtodesigntheclasses?10推薦Craig

Larman:ApplyingUMLandPatterns:AnIntroductiontoObject-OrientedAnalysisandDesignandIterativeDevelopment

11面向?qū)ο蠓治鯫OA是軟件開發(fā)過程中的問題定義階段領(lǐng)域分析(DomainAnalysis):抽取和整理用戶需求并建立問題域精確模型的過程。以公共對象、類和框架等形式在特定應(yīng)用領(lǐng)域中標(biāo)識(shí)、分析和規(guī)約公共的可復(fù)用的軟件成分的能力。抽象出目標(biāo)系統(tǒng)的本質(zhì)屬性,建立問題領(lǐng)域模型。應(yīng)用分析(ApplicationAnalysis):將領(lǐng)域分析建立起來的問題領(lǐng)域模型,用某種基于計(jì)算機(jī)系統(tǒng)的語言來表示。響應(yīng)時(shí)間需求、用戶界面需求和數(shù)據(jù)安全等特殊的需求也都在這一層分解抽出。12面向?qū)ο蠓治鲱I(lǐng)域分析領(lǐng)域知識(shí)源領(lǐng)域分析模型領(lǐng)域分析技術(shù)文件專家建議已有應(yīng)用客戶考察目前/未來的需求類的分類復(fù)用標(biāo)準(zhǔn)功能模型領(lǐng)域語言1314面向?qū)ο蠓治鼍唧w步驟獲取用戶基本需求標(biāo)識(shí)類和對象定義類的結(jié)構(gòu)和層次表示類(對象)間的關(guān)系為對象行為建模常用用例來收集和描述用戶的需求標(biāo)識(shí)類及類的屬性和服務(wù)描述系統(tǒng)的靜態(tài)結(jié)構(gòu)描述系統(tǒng)的動(dòng)態(tài)行為15需求分析Waterfall式開發(fā)其需求分析一開始(其實(shí)是過早地)確定的features在最終產(chǎn)品中真正采用情況的比例16RequirementchecklistFURPS+Functionalfeatures,capabilities,securityUsabilityhumanfactors,help,documentationReliabilityfrequencyoffailure,recoverability,predictabilityPerformanceresponsetimes,throughput,accuracy,availability,resourceusage.Supportabilityadaptability,maintainability,internationalization,configurability.“+”ImplementationInterfaceOperationsPackagingLegal17ClassificationFunctionalrequirements:behavior,features,capabilities,securityUsabilityrequirements:humanfactors,help,documentation“Thefontonthedisplayshouldbereadablefrom5feet”18ClassificationReliabilityrequirements:frequencyoffailure,recoverabilityPerformancerequirements:responsetimes,throughput,accuracy,availability,resourceusage,etc.19ClassificationSupportabilityrequirements:adaptability,internationalization,maintainability“Thesystemshouldallowfrequentandeasychangesinthenetworkconfiguration”The+intheFURPS+:Implementationrequirements:“MustuseLinuxandJava”20面向?qū)ο蠓治鯫OA模型基本模型(類圖)對象層特征層關(guān)系層交互圖主題圖詳細(xì)說明21面向?qū)ο笤O(shè)計(jì)OOD是面向?qū)ο蠓椒ㄔ谲浖O(shè)計(jì)階段應(yīng)用與擴(kuò)展的結(jié)果,通常分為兩個(gè)階段高層設(shè)計(jì):建立應(yīng)用的體系結(jié)構(gòu)低層設(shè)計(jì):集中于類的詳細(xì)設(shè)計(jì)OOD的準(zhǔn)則抽象,信息隱藏,模塊化,弱耦合,強(qiáng)內(nèi)聚,可重用22面向?qū)ο笤O(shè)計(jì)OOD具體內(nèi)容按實(shí)現(xiàn)條件對OOA模型進(jìn)行調(diào)整,并補(bǔ)充幾個(gè)新的組成部分:設(shè)計(jì)問題域組元設(shè)計(jì)人機(jī)交互組元設(shè)計(jì)任務(wù)管理組元設(shè)計(jì)數(shù)據(jù)管理組元23摘要引言如何發(fā)現(xiàn)“類”如何設(shè)計(jì)“類”小結(jié)24回顧:三個(gè)世界ThreeworldsVisualmodeling25現(xiàn)實(shí)世界問題世界軟件世界Reality抽象26問題:Howtofindtheclasses?Usecase基于需求文檔Use-casemodel:writingrequirementsincontext27用例(UseCases)用例是一個(gè)敘述性文檔,用來描述參與者使用系統(tǒng)完成某個(gè)過程時(shí)的事件發(fā)生順序。用例乃是對過程的描述。過程描述事件、動(dòng)作和事務(wù)處理自始至終的發(fā)生順序。Usecasesaretextdocuments,notdiagrams,anduse-casemodelingisprimarilyanactofwritingtext,notdrawingdiagrams.28UseCase例子:ProcessSale:Acustomerarrivesatacheckoutwithitemstopurchase.ThecashierusesthePOSsystemtorecordeachpurchaseditem.Thesystempresentsarunningtotalandline-itemdetails.Thecustomerenterspaymentinformation,whichthesystemvalidatesandrecords.Thesystemupdatesinventory.Thecustomerreceivesareceiptfromthesystemandthenleaveswiththeitems.29Actor,Scenario,UseCase簡單地說,anactorissomethingwithbehavior,suchasaperson(identifiedbyrole),computersystem,ororganization;forexample,acashier.Ascenarioisaspecificsequenceofactionsandinteractionsbetweenactorsandthesystem;itisalsocalledausecaseinstance.Itisoneparticularstoryofusingasystem,oronepaththroughtheusecase;forexample,thescenarioofsuccessfullypurchasingitemswithcash,orthescenariooffailingtopurchaseitemsbecauseofacreditpaymentdenial.ausecaseisacollectionofrelatedsuccessandfailurescenariosthatdescribeanactorusingasystemtosupportagoal.Forexample,hereisacasualformatusecasewithalternatescenarios:30ProcessSale3132Actor有GoalIvarJacobson:Asetofuse-caseinstances,whereeachinstanceisasequenceofactionsasystemperformsthat

yieldsanobservableresultofvaluetoaparticularactor.軟件工程師容易犯的錯(cuò)誤:自認(rèn)為所做的是客戶/

用戶需要的。不能代替客戶/用戶假想其價(jià)值所在。33創(chuàng)建USECASE的一些原則用例可以是一個(gè)場景,包括動(dòng)作和交互。用例可以是一組場景,描述不同場景下的行為。這種書寫格式可以在任何時(shí)候描述有變體的行為,例如黑盒需求,業(yè)務(wù)流程,系統(tǒng)設(shè)計(jì)說明。

用例里不要有系統(tǒng)設(shè)計(jì),用例里不要有界面設(shè)計(jì),用例里不要有特性列表,用例里不要有測試。用例應(yīng)該描述行為需求。用例的主場景不要超過九步??梢栽谶m當(dāng)?shù)膶哟紊系玫阶幽繕?biāo)和移除設(shè)計(jì)說明。用例的最大價(jià)值不在于主場景,而是在于備選行為。主場景可能只占用例長度的四分之一到十分之一。34用例的識(shí)別界定系統(tǒng)邊界基于參與者先識(shí)別參與者對每個(gè)參與者,找出其所發(fā)起和參與的過程基于事件識(shí)別系統(tǒng)必須響應(yīng)的外部事件把事件與參與者和用例聯(lián)系起來35邊界,Actors,Goals36識(shí)別Actors及其Goals除了明顯的Actors之外,還要問問諸如以下這些問題:Whostartsandstopsthesystem?Whodoessystemadministration?Whodoesuserandsecuritymanagement?Is"time"anactorbecausethesystemdoessomethinginresponsetoatimeevent?Isthereamonitoringprocessthatrestartsthesystemifitfails?Whoevaluatessystemactivityorperformance?Howaresoftwareupdateshandled?Pushorpullupdate?Whoevaluateslogs?Aretheyremotelyretrieved?Inadditiontohumanprimaryactors,arethereanyexternalsoftwareorroboticsystemsthatcalluponservicesofthesystem?Whogetsnotifiedwhenthereareerrorsorfailures?37Usecasesfavorafunctionalapproach!“Also,nameusecasesstartingwithaverb.”NOTveryusefulinfindingclasses.But,usefulinunderstandingrequirements,validatingtheresultedmodelandimplementation.此外還要對照FURPS+檢查其他需求38Findtheclasses“Thenounsandtheverbs”啟發(fā):類與方法;但是“Theelevatorwillcloseitsdoorbeforeitmovestoanotherfloor.”有的名詞不是類;有的類不表現(xiàn)為名詞;基本原則:ADT39Findtheclasses沒有機(jī)械的辦法?;诮?jīng)驗(yàn)的啟發(fā)性、指導(dǎo)性的原則:哪些東西是可能的類;哪些形式的類不理想,可考慮從模型中去除;40Theidealclass明確的抽象類名是名詞或形容詞,刻畫該抽象形容詞常用于表達(dá)接口代表一系列運(yùn)行時(shí)刻的對象。(允許特意的singleton)有修改操作(或作用式操作)形式或非形式地刻畫性質(zhì):不變式前后置斷言41三種類分析類直接對應(yīng)于問題域設(shè)計(jì)類為得到優(yōu)雅的、可擴(kuò)展的結(jié)構(gòu)而引入實(shí)現(xiàn)類滿足軟件系統(tǒng)實(shí)現(xiàn)算法所需。如LinkedList;Array等42分析類Analysisclassesrepresentanearlyconceptualmodelfor‘thingsinthesystemwhichhaveresponsibilitiesandbehavior’.Analysisclassesareusedtocapturea‘first-draft’,rough-cutoftheobjectmodelofthesystem.Analysisclasseshandleprimarilyfunctionalrequirements.Theymodelobjectsfromtheproblemdomain.43分析類Therearethreeaspectsofthesystemthatarelikelytochange:

theboundarybetweenthesystemanditsactors(boundary)theinformationthesystemuses(entity)thecontrollogicofthesystem(control)behaviourinformationboundary44Heuristicsforfindingclasses尋找分析類OperationalModelofsomeaspectoftheexternalworld.SimulationButexternalclassescanbequiteabstract不一定是客觀實(shí)體,也可能是抽象概念45Heuristicsforfindingclasses尋找實(shí)現(xiàn)類實(shí)現(xiàn)難多復(fù)用數(shù)據(jù)結(jié)構(gòu)與算法知識(shí)延遲實(shí)現(xiàn)類如“Queue”類層次組織多種不同實(shí)現(xiàn)46Heuristicsforfindingclasses尋找設(shè)計(jì)類創(chuàng)造性工作設(shè)計(jì)模式的用武之地其他途徑舊系統(tǒng)Adaptationthroughinheritance4748495051DomainModel領(lǐng)域模型Adomainmodelisarepresentationofreal-worldconceptualclasses

notarepresentationofsoftwarecomponents.notasetofdiagramsdescribingsoftwareclasses,notsoftwareobjectswithresponsibilities.Adomainmodelisavisualrepresentationofconceptualclassesorreal-worldobjectsinadomainofinterest[MO95,Fowler96]Theyhavealsobeencalledconceptualmodels,domainobjectmodels,andanalysisobjectmodelsTheUPdefinesaDomainModelasoneoftheartifactsthatmaybecreatedintheBusinessModelingdiscipline.52DomainModelUsingUMLnotation,adomainmodelisillustratedwithasetofclassdiagramsinwhichnooperationsaredefined.Itmayshow:domainobjectsorconceptualclassesassociationsbetweenconceptualclassesattributesofconceptualclasses>>Informally,aconceptualclassisanidea,thing,orobject.>>Moreformally,aconceptualclassmaybeconsideredintermsofitssymbol,intension,andextension[MO95].53DomainModel54DomainModelSoftwareproblemscanbecomplex;Decomposition(divide-and-conquer)isacommonstrategytodealwiththiscomplexitybydivisionoftheproblemspaceintocomprehensibleunits.Instructuredanalysis,thedimensionofdecompositionisbyprocessesorfunctions.However,inobject-orientedanalysis,thedimensionofdecompositionisfundamentallybythingsorentitiesinthedomain.Acentraldistinctionbetweenobject-orientedandstructuredanalysisis:divisionbyconceptualclasses(objects)ratherthandivisionbyfunctions.Aprimaryanalysistaskistoidentifydifferentconceptsintheproblemdomainanddocumenttheresultsinadomainmodel55SystemSequenceDiagrams識(shí)別系統(tǒng)事件定義系統(tǒng)操作給出這些操作的Contracts57ContractCO2:enterItemOperation:enterItem(itemID:ItemID,quantity:integer)CrossReferences:UseCases:ProcessSalePreconditions:Thereisasaleunderway.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論