版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1SE3121021:SoftwareArchitecture
SoftwareArchitectureStyle
2SoftwareArchitectureStyle:Call/Return
調(diào)用/返回
3Call/Return的不同種類Mainprogramandsubroutines主程序和子程序Classicalprogrammingparadigm-functionaldecompositionObject-Oriented/AbstractDataTypesInformation(representation,accessmethod)hidingLayeredhierarchiesEachlevelonlycommunicateswithitsimmediateneighborsOtherClient/Server……4HistoryMainprogramandsubroutines單線程控制,劃分為若干處理步驟Functionalmodules把處理步驟集成到模塊內(nèi)AbstractDataTypes操作和數(shù)據(jù)捆綁在一起,隱藏具體實(shí)現(xiàn)Objects方法(動態(tài)綁定),多態(tài)(子類),重用(繼承)OOArchitectures對象活動在不同的進(jìn)程/線程Client/Server,tieredstylesComponents多個接口,二進(jìn)制兼容,中間件也是編程語言的發(fā)展歷程5MainProgramandSubroutine思考:此圖為有向圖,是否可能出現(xiàn)環(huán)?6MainProgramandSubroutineProblem:Thispatternissuitableforapplicationsinwhichthecomputationcanappropriatelybedefinedviaahierarchyofproceduredefinitions.存在層次結(jié)構(gòu)Context:Manyprogramminglanguagesprovidenaturalsupportfordefiningnestedcollectionsofprocedures(過程的嵌套)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隱藏“會變”的,暴露“不變”的12Encapsulation/InformationHidingParnas:Hidesecrets(notjustrepresentations)Booch:Object’sbehaviorischaracterizedbyactionsthat
itsuffersandthatitrequiresPracticallyspeaking:Objecthasstateandoperations,butalsohasresponsibilityfortheintegrityofitsstate(state相當(dāng)于內(nèi)部數(shù)據(jù)成員)ObjectisknownbyitsinterfaceObjectisprobablyinstantiatedfromatemplate(類)Objecthasoperationstoaccessandalterstateandperhapsgenerator(構(gòu)造函數(shù))Therearedifferentkindsofobjects(e.g.,actor,agent,server)13Object-Oriented14DataAbstractionorObject-OrientedProblem:Thispatternissuitableforapplicationsinwhichacentralissueisidentifyingandprotectingrelatedbodiesofinformation,especiallyrepresentationinformation。OO是對現(xiàn)實(shí)中離散事件和個體交互的仿真,最適合模擬現(xiàn)實(shí)。Context:Numerousdesignmethodsprovidestrategiesforidentifyingnaturalobjects.Newerprogramminglanguagessupportvariousvariationsonthetheme,soifthelanguagechoiceorthemethodologyisfixed,thatwillstronglyinfluencetheflavorofthedecomposition.Solution:Systemmodel:localizedstatemaintenanceComponents:managers(e.g.,servers,objects,abstractdatatypes)Connectors:procedurecallControlstructure:decentralized,usuallysinglethread15ElementsofObjectArchitecturesEncapsulation:Restrictaccesstocertaininformation
封裝:限制對某些信息的訪問Interaction:Viaprocedurecallsorsimilarprotocol
交互:通過過程調(diào)用或類似的協(xié)議Polymorphism:Choosethemethodatrun-time
多態(tài):在運(yùn)行時選擇具體的操作Inheritance:Shareddefinitionsoffunctionality
繼承:對共享的功能保持唯一的接口Reuseandmaintenance:Exploitencapsulationandlocalitytoincreaseproductivity
復(fù)用和維護(hù):利用封裝和聚合提高生產(chǎn)力嚴(yán)重依賴于具體使用的語言16ProblemswithObjectApproachesManagingmanyobjectsvastseaofobjectsrequiresadditionalstructuring
大量對象需要額外的結(jié)構(gòu)來容納hierarchicaldesignsuggestedbyBoochandParnasManagingmanyinteractionssingleinterfacecanbelimiting&unwieldy(hence,“friends”)
只提供單一的接口不靈活(于是,“友元”)somelanguages/systemspermitmultipleinterfaces(innerclass,interface,multipleinheritance)DistributedresponsibilityforbehaviormakessystemhardtounderstandinteractiondiagramsnowusedindesignCapturingfamiliesofrelateddesignstypes/classesareoftennotenough類圖無法表示運(yùn)行時內(nèi)存狀態(tài)designpatterns作為解決此問題的一個分支17ManagingLargeObjectSetsPureO-OdesignleadstolargeflatsystemswithmanyobjectsSameoldproblemscanreappearHundredsofmodules=>hardtofindthingsNeedawaytoimposestructureNeedadditionalstructureanddisciplineStructuringoptionsLayers(whicharenotnecessarilyobjects)SupplementalindexHierarchicaldecomposition:bigobjectsandlittleobjects18StylisticVariationsClient-serverObjectsareprocesses
進(jìn)程就是對象Asymmetric:clientknowsaboutservers,butnotviceversa
不對稱:客戶端知道服務(wù)器,反之則不然TieredElaborationonclient-server
C/S模式的擴(kuò)展Aggregationintorun-timestrata
運(yùn)行時層的結(jié)合Usuallysmallnumberoftiers
通常只有少量的層Components(later)MultipleinterfacesSpecialprotocolsfordynamicreconfiguration
支持動態(tài)配置的專門協(xié)議19Layeredsystem無處不在的層次結(jié)構(gòu)硬件OS應(yīng)用應(yīng)用應(yīng)用平臺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ù),只能見到與自己鄰接的層適當(dāng)時候(迫不得已時),可以允許一定的越層操作大的問題分解為若干個漸進(jìn)的小問題,逐步解決,隱藏了很多復(fù)雜度修改一層,最多影響兩層,而通常只能影響上層。若層之間接口穩(wěn)固,則不會造成其他影響上層必須知道下層的身份,不能調(diào)整層次之間的順序?qū)訉酉嗾{(diào),影響性能25TheMiddlewareViewMainfeaturestieredsystemfactorout50%-90%ofapplicationindependentcodeintosharedservicesbuildonexistingtransport/communicationinfrastructureApplicationsCommonApplicationServicesCommonTransportServicesinvokes26Client/Server
服務(wù)器客戶客戶客戶客戶客戶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是基于資源不對等,且為實(shí)現(xiàn)共享而提出的,20世紀(jì)90年代成熟起來C/S有三個主要組成部分:數(shù)據(jù)庫服務(wù)器、客戶端和網(wǎng)絡(luò)服務(wù)器(后臺)負(fù)責(zé)數(shù)據(jù)管理,客戶端(前臺)完成與用戶的交互任務(wù)?!芭挚蛻舳?,瘦服務(wù)器”缺點(diǎn):對客戶端軟硬件配置要求較高,客戶端臃腫客戶端程序設(shè)計復(fù)雜數(shù)據(jù)安全性不好??蛻舳顺绦蚩梢灾苯釉L問數(shù)據(jù)庫服務(wù)器。信息內(nèi)容和形式單一用戶界面風(fēng)格不一,使用繁雜,不利用推廣使用軟件維護(hù)與升級困難。每個客戶機(jī)上的軟件都需要維護(hù)30三層Client/ServerClient-Application-Server與二層C/S結(jié)構(gòu)相比,增加了一個應(yīng)用服務(wù)器。整個應(yīng)用邏輯駐留在應(yīng)用服務(wù)器上,只有表示層存在于客戶機(jī)上(“瘦客戶端”)應(yīng)用功能分為表示層、功能層、數(shù)據(jù)層三層表示層是應(yīng)用的用戶接口部分。通常使用圖形用戶界面功能層是應(yīng)用的主體,實(shí)現(xiàn)具體的業(yè)務(wù)處理邏輯數(shù)據(jù)層是數(shù)據(jù)庫管理系統(tǒng)。以上三層邏輯上獨(dú)立。通常只有表示層配置在客戶端中思考:“瘦客戶端”的三層C/S有何優(yōu)缺點(diǎn)?3132Client-Application-Server…33B/SB/S是三層C/S的特例客戶端為http瀏覽器為增強(qiáng)功能,往往還需要安裝flash、jvm及一些專用插件使用標(biāo)準(zhǔn)http/https協(xié)議要考慮瀏覽器兼容的問題通常只能“拉”,不能“推”客戶之間的通信只能通過服務(wù)器中轉(zhuǎn)安全性較難控制(SQL注入攻擊等)數(shù)據(jù)查詢等響應(yīng)速度低于C/S體系結(jié)構(gòu)服務(wù)器的負(fù)荷大,客戶機(jī)的資源浪費(fèi)用RIA等技術(shù)解決,主流瀏覽器也對硬件逐步利用到底應(yīng)把主要的計算量放到客戶機(jī)還是服務(wù)器?34SoftwareArchitectureStyle:
DataCentered/SharedData
3536SharedInformationSystemsStylerepresentsalargevarietyofsystems
這種風(fēng)格描繪很多種系統(tǒng)manyvariantsdependingonnatureofshareddata
共同特點(diǎn)是共享數(shù)據(jù)Styleaddressesmechanismsfor:collecting,manipulatingandpreservinglargebodiesofdata
收集、操作、存儲大量的數(shù)據(jù)Databasesareanaturalexample,butnottheonlyone
數(shù)據(jù)庫是一個典型的例子37SharedInformationSystemsHighlevelviewwhataretheapparentfeaturesofthisstyle?whataresomeissuesregardingthisstyle?
星型結(jié)構(gòu)簡化了拓?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ù)即時存取requirementtomakeaccesstodataeasyandinstanthelptodrivetheshiftfrombatch-sequentialtointeractiveprocessingTodaysharedinformationsystemsappeareverywherefromthesmallestbusiness,tothemostadvancedscientificapplicationsmanyapplicationsprovideaccessmechanismstoshareddatatheWebhasbecomeagiantdistributedrepository40EvolutionofSharedInformationSystemsBatchSequentialSystemsflatfileaccess(I/O)41EvolutionofSharedInformationSystemsDatapool(SharedMemory)Example:EnabledbyavailabilityofRAMandlanguagestopermitthesharingofcommondata(E.g.,FORTRANCOMMONBLOCK)ProcessesarenotnecessarilysequentialGetsmessywithoutimplementationrules-whataretheissues?42RepositoryArchitecture除數(shù)據(jù)庫外,剪貼板、注冊表是典型的倉庫風(fēng)格的例子43EvolvingDatabaseArchitecturesBatchprocessing:Standaloneprograms(獨(dú)立的程序)resultswerepassedfromonetoanotheronmag-tape(結(jié)果通過磁帶從一個程序傳到另一個程序)batchsequentialmodel(批處理模式)Interactiveprocessing:concurrentoperationandfasterupdatesprecludebatching,soupdatesareoutofsynchwithreports.
并行操作、更快的更新速度,但是使更新難以保持和報告同步。Repositorymodelwithexternalcontrol(倉庫風(fēng)格)現(xiàn)狀:信息分散在很多數(shù)據(jù)庫中問題:想買本書,如何了解哪個網(wǎng)站最便宜?4445UnifiedSchemasforIntegratingDatabasesAbstraction:multiplexthedatabases;put
filtersonthequery/updateto
matchdiverseviews集成多個數(shù)據(jù)庫;
在查詢/更新操作中
增加過濾器/包裝器來匹配
不同的視圖難點(diǎn):查詢分解、結(jié)果合并46Multi-databases47ComputerAidedSoftware
EngineeringInitiallyjusttranslationfromsourcetoobjectcode:compiler,library,linker,make
起初,就是做從源代碼到目標(biāo)代碼的轉(zhuǎn)換Grewtoincludedesignrecord,documentation,analysis,configurationcontrol,incrementality
開始包含分析、設(shè)計、調(diào)試、測試、文檔、配置管理、增量編譯等功能Integrationdemandedfor20years,butnothereyet.
集成已經(jīng)作了20年,但還沒有結(jié)束48CASEvs.DBMSAscomparedtodatabases,CASEhas:moretypesofdata
更多的數(shù)據(jù)類型fewerinstancesofeachtype
更少的數(shù)據(jù)類型實(shí)例slowerqueryrates
更慢的查詢頻率larger,morecomplex,lessdiscreteinformation
更大,更復(fù)雜,更集中的信息butnotshorterlifetime
生命周期沒有更短49TraditionalCompiler50Example:ModernCanonicalCompiler51CanonicalCompiler52SoftwareToolswithSharedRepresentation53EvolutionofCASEEnvironmentsEvolutionismuchlikedatabases:Interaction:batch-->interactive
交互:批處理交互式Granularity:completeprocessing-->incremental
粒度:完全處理增量Coverage:compilation-->fulllifecycle
覆蓋:編譯全生命周期Likedatabases,startedwithbatchsequentialstyle
從批處理風(fēng)格開始Integrationneedsledtorepositorieswithrigidcontrol,thentoopensystemsinlayers
對集成性的要求,促成了倉庫風(fēng)格被應(yīng)用,讓系統(tǒng)開始分層54RepositoryProblem:Thispatternissuitableforapplications
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《畫漫畫》教案設(shè)計中的新技術(shù)應(yīng)用
- 安川機(jī)器人2024校園招聘培訓(xùn)會安排
- 第47屆世界技能大賽江蘇省選拔賽油漆與裝飾項(xiàng)目技術(shù)工作文件
- 《童趣》課件的制作與使用
- 2024年20加減法課件:創(chuàng)新與實(shí)踐的結(jié)合
- 2024版《工程制圖》教案:教學(xué)理念與實(shí)踐相結(jié)合
- 探索2024:敕勒歌教學(xué)課程規(guī)劃
- 黑龍江省安全員B證考試題庫及答案
- 《軟件與信息服務(wù)》重點(diǎn)專業(yè)建設(shè)方案
- 2024年巴西城市規(guī)劃與可持續(xù)發(fā)展
- 八上歷史全冊知識梳理
- 2024秋期國家開放大學(xué)《公共部門人力資源管理》一平臺在線形考(形考任務(wù)1至4)試題及答案
- 2024年銀行考試-招商銀行考試近5年真題集錦(頻考類試題)帶答案
- 中小學(xué)-校園文明禮儀-課件
- 期中考試試題(1-4單元)(試題)-2024-2025學(xué)年二年級上冊數(shù)學(xué)青島版
- 浙教版(2023)四年級上冊信息科技-教學(xué)計劃
- (新版)糖尿病知識競賽考試題庫300題(含答案)
- 技術(shù)創(chuàng)新課件教學(xué)課件
- 第四章 光現(xiàn)象章節(jié)練習(xí)2024-2025學(xué)年人教版八年級物理上冊
- 個人簡歷模板(5套完整版)
- 《中國腫瘤防治核心科普知識(2024)》解讀
評論
0/150
提交評論