SA02.2 Style 調(diào)用返回 倉(cāng)庫(kù)_第1頁(yè)
SA02.2 Style 調(diào)用返回 倉(cāng)庫(kù)_第2頁(yè)
SA02.2 Style 調(diào)用返回 倉(cāng)庫(kù)_第3頁(yè)
SA02.2 Style 調(diào)用返回 倉(cāng)庫(kù)_第4頁(yè)
SA02.2 Style 調(diào)用返回 倉(cāng)庫(kù)_第5頁(yè)
已閱讀5頁(yè),還剩35頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1SE3121021:SoftwareArchitecture

SoftwareArchitectureStyle

2SoftwareArchitectureStyle:Call/Return

調(diào)用/返回

3Call/Return的不同種類(lèi)Mainprogramandsubroutines主程序和子程序Classicalprogrammingparadigm-functionaldecompositionObject-Oriented/AbstractDataTypesInformation(representation,accessmethod)hidingLayeredhierarchiesEachlevelonlycommunicateswithitsimmediateneighborsOtherClient/Server……4HistoryMainprogramandsubroutines單線(xiàn)程控制,劃分為若干處理步驟Functionalmodules把處理步驟集成到模塊內(nèi)AbstractDataTypes操作和數(shù)據(jù)捆綁在一起,隱藏具體實(shí)現(xiàn)Objects方法(動(dòng)態(tài)綁定),多態(tài)(子類(lèi)),重用(繼承)OOArchitectures對(duì)象活動(dòng)在不同的進(jìn)程/線(xiàn)程Client/Server,tieredstylesComponents多個(gè)接口,二進(jìn)制兼容,中間件也是編程語(yǔ)言的發(fā)展歷程5MainProgramandSubroutine思考:此圖為有向圖,是否可能出現(xiàn)環(huán)?6MainProgramandSubroutineProblem:Thispatternissuitableforapplicationsinwhichthecomputationcanappropriatelybedefinedviaahierarchyofproceduredefinitions.存在層次結(jié)構(gòu)Context:Manyprogramminglanguagesprovidenaturalsupportfordefiningnestedcollectionsofprocedures(過(guò)程的嵌套)andforcallingthemhierarchically.Theselanguagesoftenallowcollectionsofprocedurestobegroupedintomodules,therebyintroducingname-spacelocality.Theexecutionenvironmentusuallyprovidesasinglethreadofcontrolinasinglenamespace.Solution:Systemmodel:callanddefinitionhierarchy,subsystemsoftendefinedviamodularityComponents:proceduresandexplicitlyvisibledataConnectors:procedurecallsandexplicitdatasharingControlstructure:singlethread7MainProgramandSubroutine:ModelHierarchicaldecomposition:Basedondefinition-userelationshipUsesprocedurecallasinteractionmechanismSinglethreadofcontrol:SupporteddirectlybyprogramminglanguagesHierarchicalreasoning:Correctnessofasubroutinedependsonthecorrectnessofthesubroutinesitcalls。這里有遞歸的含義Subsystemstructureimplicit:Subroutinestypicallyaggregatedintomodules8MainProgramandSubroutine9PipesvsProceduresPipesProceduresControlAsynchronous異步,data-drivenSynchronous同步,blockingSemanticsFunctionalHierarchicalDataStreamedParameter/returnvalueVariationsBuffering,end-of-filebehaviorBindingtime,exceptionhandling,polymorphism函數(shù)式編程命令式編程10CriteriaforModularizationWhatisamodule?Commonview:apieceofcode.Buttoolimited.Compilationunit,includingrelateddeclarationsandinterfaceWhymodularizeasystem,anyway?Management:PartitiontheoveralldevelopmenteffortdivideandconquerEvolution:DecouplepartsofasystemsothatchangestoonepartareisolatedfromchangestootherpartsUnderstanding:Permitsystemtobeunderstoodascompositionofmind-sizedchunksKeyissue:whatcriteriatouseformodularization11ModuleDecompositionParnasHidesecrets.OK,what’sa“secret”?RepresentationofdataPropertiesofadevice,otherthanrequiredpropertiesTrytolocalizefuturechangeHidesystemdetailslikelytochangeindependentlyExposeininterfacesassumptionsunlikelytochangeUsefunctionstoallowforchangeThey’reeasiertochangethanvisiblerepresentation隱藏“會(huì)變”的,暴露“不變”的12Encapsulation/InformationHidingParnas:Hidesecrets(notjustrepresentations)Booch:Object’sbehaviorischaracterizedbyactionsthat

itsuffersandthatitrequiresPracticallyspeaking:Objecthasstateandoperations,butalsohasresponsibilityfortheintegrityofitsstate(state相當(dāng)于內(nèi)部數(shù)據(jù)成員)ObjectisknownbyitsinterfaceObjectisprobablyinstantiatedfromatemplate(類(lèi))Objecthasoperationstoaccessandalterstateandperhapsgenerator(構(gòu)造函數(shù))Therearedifferentkindsofobjects(e.g.,actor,agent,server)13Object-Oriented14DataAbstractionorObject-OrientedProblem:Thispatternissuitableforapplicationsinwhichacentralissueisidentifyingandprotectingrelatedbodiesofinformation,especiallyrepresentationinformation。OO是對(duì)現(xiàn)實(shí)中離散事件和個(gè)體交互的仿真,最適合模擬現(xiàn)實(shí)。Context:Numerousdesignmethodsprovidestrategiesforidentifyingnaturalobjects.Newerprogramminglanguagessupportvariousvariationsonthetheme,soifthelanguagechoiceorthemethodologyisfixed,thatwillstronglyinfluencetheflavorofthedecomposition.Solution:Systemmodel:localizedstatemaintenanceComponents:managers(e.g.,servers,objects,abstractdatatypes)Connectors:procedurecallControlstructure:decentralized,usuallysinglethread15ElementsofObjectArchitecturesEncapsulation:Restrictaccesstocertaininformation

封裝:限制對(duì)某些信息的訪(fǎng)問(wèn)Interaction:Viaprocedurecallsorsimilarprotocol

交互:通過(guò)過(guò)程調(diào)用或類(lèi)似的協(xié)議Polymorphism:Choosethemethodatrun-time

多態(tài):在運(yùn)行時(shí)選擇具體的操作Inheritance:Shareddefinitionsoffunctionality

繼承:對(duì)共享的功能保持唯一的接口Reuseandmaintenance:Exploitencapsulationandlocalitytoincreaseproductivity

復(fù)用和維護(hù):利用封裝和聚合提高生產(chǎn)力嚴(yán)重依賴(lài)于具體使用的語(yǔ)言16ProblemswithObjectApproachesManagingmanyobjectsvastseaofobjectsrequiresadditionalstructuring

大量對(duì)象需要額外的結(jié)構(gòu)來(lái)容納hierarchicaldesignsuggestedbyBoochandParnasManagingmanyinteractionssingleinterfacecanbelimiting&unwieldy(hence,“friends”)

只提供單一的接口不靈活(于是,“友元”)somelanguages/systemspermitmultipleinterfaces(innerclass,interface,multipleinheritance)DistributedresponsibilityforbehaviormakessystemhardtounderstandinteractiondiagramsnowusedindesignCapturingfamiliesofrelateddesignstypes/classesareoftennotenough類(lèi)圖無(wú)法表示運(yùn)行時(shí)內(nèi)存狀態(tài)designpatterns作為解決此問(wèn)題的一個(gè)分支17ManagingLargeObjectSetsPureO-OdesignleadstolargeflatsystemswithmanyobjectsSameoldproblemscanreappearHundredsofmodules=>hardtofindthingsNeedawaytoimposestructureNeedadditionalstructureanddisciplineStructuringoptionsLayers(whicharenotnecessarilyobjects)SupplementalindexHierarchicaldecomposition:bigobjectsandlittleobjects18StylisticVariationsClient-serverObjectsareprocesses

進(jìn)程就是對(duì)象Asymmetric:clientknowsaboutservers,butnotviceversa

不對(duì)稱(chēng):客戶(hù)端知道服務(wù)器,反之則不然TieredElaborationonclient-server

C/S模式的擴(kuò)展Aggregationintorun-timestrata

運(yùn)行時(shí)層的結(jié)合Usuallysmallnumberoftiers

通常只有少量的層Components(later)MultipleinterfacesSpecialprotocolsfordynamicreconfiguration

支持動(dòng)態(tài)配置的專(zhuān)門(mén)協(xié)議19Layeredsystem無(wú)處不在的層次結(jié)構(gòu)硬件OS應(yīng)用應(yīng)用應(yīng)用平臺(tái)20OSI參考模型2122ThelayeredarchitecturalpatternProblem:Thispatternissuitableforapplicationsthatinvolvedistinctclassesofservicesthatcanbearrangedhierarchically.Oftentherearelayersforbasicsystem-levelservices,forutilitiesappropriatetomanyapplications,andforspecifictasksoftheapplication.Context:Frequently,eachclassofserviceisassignedtoalayerandseveraldifferentpatternsareusedtorefinethevariouslayers.Layersaremostoftenusedatthehigherlevelsofdesign,usingdifferentpatternstorefinethelayers.Solution:Systemmodel:hierarchyofopaque(不透明的)layersComponents:usuallycomposites;compositesaremostoftencollectionsofproceduresConnectors:dependsonstructureofcomponents;oftenprocedurecallsunderrestrictedvisibility,mightalsobeclient/serverControlstructure:singlethread23Thelayeredarchitecturalpattern24層次風(fēng)格特點(diǎn)每層為上一層提供服務(wù),使用下一層的服務(wù),只能見(jiàn)到與自己鄰接的層適當(dāng)時(shí)候(迫不得已時(shí)),可以允許一定的越層操作大的問(wèn)題分解為若干個(gè)漸進(jìn)的小問(wèn)題,逐步解決,隱藏了很多復(fù)雜度修改一層,最多影響兩層,而通常只能影響上層。若層之間接口穩(wěn)固,則不會(huì)造成其他影響上層必須知道下層的身份,不能調(diào)整層次之間的順序?qū)訉酉嗾{(diào),影響性能25TheMiddlewareViewMainfeaturestieredsystemfactorout50%-90%ofapplicationindependentcodeintosharedservicesbuildonexistingtransport/communicationinfrastructureApplicationsCommonApplicationServicesCommonTransportServicesinvokes26Client/Server

服務(wù)器客戶(hù)客戶(hù)客戶(hù)客戶(hù)客戶(hù)LocalLoopback27Client/ServerStyle兩層C/S結(jié)構(gòu)三層C/S結(jié)構(gòu)B/S結(jié)構(gòu)(瀏覽器/服務(wù)器風(fēng)格)28兩層Client/ServerWorkstations包含顯示層與業(yè)務(wù)層,Server只有數(shù)據(jù)29兩層Client/ServerC/S是基于資源不對(duì)等,且為實(shí)現(xiàn)共享而提出的,20世紀(jì)90年代成熟起來(lái)C/S有三個(gè)主要組成部分:數(shù)據(jù)庫(kù)服務(wù)器、客戶(hù)端和網(wǎng)絡(luò)服務(wù)器(后臺(tái))負(fù)責(zé)數(shù)據(jù)管理,客戶(hù)端(前臺(tái))完成與用戶(hù)的交互任務(wù)?!芭挚蛻?hù)端,瘦服務(wù)器”缺點(diǎn):對(duì)客戶(hù)端軟硬件配置要求較高,客戶(hù)端臃腫客戶(hù)端程序設(shè)計(jì)復(fù)雜數(shù)據(jù)安全性不好??蛻?hù)端程序可以直接訪(fǎng)問(wèn)數(shù)據(jù)庫(kù)服務(wù)器。信息內(nèi)容和形式單一用戶(hù)界面風(fēng)格不一,使用繁雜,不利用推廣使用軟件維護(hù)與升級(jí)困難。每個(gè)客戶(hù)機(jī)上的軟件都需要維護(hù)30三層Client/ServerClient-Application-Server與二層C/S結(jié)構(gòu)相比,增加了一個(gè)應(yīng)用服務(wù)器。整個(gè)應(yīng)用邏輯駐留在應(yīng)用服務(wù)器上,只有表示層存在于客戶(hù)機(jī)上(“瘦客戶(hù)端”)應(yīng)用功能分為表示層、功能層、數(shù)據(jù)層三層表示層是應(yīng)用的用戶(hù)接口部分。通常使用圖形用戶(hù)界面功能層是應(yīng)用的主體,實(shí)現(xiàn)具體的業(yè)務(wù)處理邏輯數(shù)據(jù)層是數(shù)據(jù)庫(kù)管理系統(tǒng)。以上三層邏輯上獨(dú)立。通常只有表示層配置在客戶(hù)端中思考:“瘦客戶(hù)端”的三層C/S有何優(yōu)缺點(diǎn)?3132Client-Application-Server…33B/SB/S是三層C/S的特例客戶(hù)端為http瀏覽器為增強(qiáng)功能,往往還需要安裝flash、jvm及一些專(zhuān)用插件使用標(biāo)準(zhǔn)http/https協(xié)議要考慮瀏覽器兼容的問(wèn)題通常只能“拉”,不能“推”客戶(hù)之間的通信只能通過(guò)服務(wù)器中轉(zhuǎn)安全性較難控制(SQL注入攻擊等)數(shù)據(jù)查詢(xún)等響應(yīng)速度低于C/S體系結(jié)構(gòu)服務(wù)器的負(fù)荷大,客戶(hù)機(jī)的資源浪費(fèi)用RIA等技術(shù)解決,主流瀏覽器也對(duì)硬件逐步利用到底應(yīng)把主要的計(jì)算量放到客戶(hù)機(jī)還是服務(wù)器?34SoftwareArchitectureStyle:

DataCentered/SharedData

3536SharedInformationSystemsStylerepresentsalargevarietyofsystems

這種風(fēng)格描繪很多種系統(tǒng)manyvariantsdependingonnatureofshareddata

共同特點(diǎn)是共享數(shù)據(jù)Styleaddressesmechanismsfor:collecting,manipulatingandpreservinglargebodiesofdata

收集、操作、存儲(chǔ)大量的數(shù)據(jù)Databasesareanaturalexample,butnottheonlyone

數(shù)據(jù)庫(kù)是一個(gè)典型的例子37SharedInformationSystemsHighlevelviewwhataretheapparentfeaturesofthisstyle?whataresomeissuesregardingthisstyle?

星型結(jié)構(gòu)簡(jiǎn)化了拓?fù)?8★SharedInformationSystemsAdvantageseasytoaddconsumersandproducersofdata

很容易增加數(shù)據(jù)的生產(chǎn)者和消費(fèi)者Howaboutmodifier?Issuessynchronization(同步)configurationandschemamanagement(配置和管理)atomicity(原子性)consistency(一致性)persistence(持久性)performance(性能)39SharedInformationSystemsLineageEarliestrepositoriesappearinbatchsequentialsystems

早期的數(shù)據(jù)共享出現(xiàn)在批處理系統(tǒng)mainframes,drums,magnetictapes,discdrivesresourcesmanuallymanagedPressureforon-lineaccesstodata

迫切需要數(shù)據(jù)即時(shí)存取requirementtomakeaccesstodataeasyandinstanthelptodrivetheshiftfrombatch-sequentialtointeractiveprocessingTodaysharedinformationsystemsappeareverywherefromthesmallestbusiness,tothemostadvancedscientificapplicationsmanyapplicationsprovideaccessmechanismstoshareddatatheWebhasbecomeagiantdistributedrepository40EvolutionofSharedInformationSystemsBatchSequentialSystemsflatfileaccess(I/O)41EvolutionofSharedInformationSystemsDatapool(SharedMemory)Example:EnabledbyavailabilityofRAMandlanguagestopermitthesharingofcommondata(E.g.,FORTRANCOMMONBLOCK)ProcessesarenotnecessarilysequentialGetsmessywithoutimplementationrules-whataretheissues?42RepositoryArchitecture除數(shù)據(jù)庫(kù)外,剪貼板、注冊(cè)表是典型的倉(cāng)庫(kù)風(fēng)格的例子43EvolvingDatabaseArchitecturesBatchprocessing:Standaloneprograms(獨(dú)立的程序)resultswerepassedfromonetoanotheronmag-tape(結(jié)果通過(guò)磁帶從一個(gè)程序傳到另一個(gè)程序)batchsequentialmodel(批處理模式)Interactiveprocessing:concurrentoperationandfasterupdatesprecludebatching,soupdatesareoutofsynchwithreports.

并行操作、更快的更新速度,但是使更新難以保持和報(bào)告同步。Repositorymodelwithexternalcontrol(倉(cāng)庫(kù)風(fēng)格)現(xiàn)狀:信息分散在很多數(shù)據(jù)庫(kù)中問(wèn)題:想買(mǎi)本書(shū),如何了解哪個(gè)網(wǎng)站最便宜?4445UnifiedSchemasforIntegratingDatabasesAbstraction:multiplexthedatabases;put

filtersonthequery/updateto

matchdiverseviews集成多個(gè)數(shù)據(jù)庫(kù);

在查詢(xún)/更新操作中

增加過(guò)濾器/包裝器來(lái)匹配

不同的視圖難點(diǎn):查詢(xún)分解、結(jié)果合并46Multi-databases47ComputerAidedSoftware

EngineeringInitiallyjusttranslationfromsourcetoobjectcode:compiler,library,linker,make

起初,就是做從源代碼到目標(biāo)代碼的轉(zhuǎn)換Grewtoincludedesignrecord,documentation,analysis,configurationcontrol,incrementality

開(kāi)始包含分析、設(shè)計(jì)、調(diào)試、測(cè)試、文檔、配置管理、增量編譯等功能Integrationdemandedfor20years,butnothereyet.

集成已經(jīng)作了20年,但還沒(méi)有結(jié)束48CASEvs.DBMSAscomparedtodatabases,CASEhas:moretypesofdata

更多的數(shù)據(jù)類(lèi)型fewerinstancesofeachtype

更少的數(shù)據(jù)類(lèi)型實(shí)例slowerqueryrates

更慢的查詢(xún)頻率larger,morecomplex,lessdiscreteinformation

更大,更復(fù)雜,更集中的信息butnotshorterlifetime

生命周期沒(méi)有更短49TraditionalCompiler50Example:ModernCanonicalCompiler51CanonicalCompiler52SoftwareToolswithSharedRepresentation53EvolutionofCASEEnvironmentsEvolutionismuchlikedatabases:Interaction:batch-->interactive

交互:批處理交互式Granularity:completeprocessing-->incremental

粒度:完全處理增量Coverage:compilation-->fulllifecycle

覆蓋:編譯全生命周期Likedatabases,startedwithbatchsequentialstyle

從批處理風(fēng)格開(kāi)始Integrationneedsledtorepositorieswithrigidcontrol,thentoopensystemsinlayers

對(duì)集成性的要求,促成了倉(cāng)庫(kù)風(fēng)格被應(yīng)用,讓系統(tǒng)開(kāi)始分層54RepositoryProblem:Thispatternissuitableforapplications

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論