軟件體系結(jié)構(gòu)3數(shù)據(jù)流體系結(jié)構(gòu)DataFlowArchitectures_第1頁
軟件體系結(jié)構(gòu)3數(shù)據(jù)流體系結(jié)構(gòu)DataFlowArchitectures_第2頁
軟件體系結(jié)構(gòu)3數(shù)據(jù)流體系結(jié)構(gòu)DataFlowArchitectures_第3頁
軟件體系結(jié)構(gòu)3數(shù)據(jù)流體系結(jié)構(gòu)DataFlowArchitectures_第4頁
軟件體系結(jié)構(gòu)3數(shù)據(jù)流體系結(jié)構(gòu)DataFlowArchitectures_第5頁
已閱讀5頁,還剩34頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、軟件體系結(jié)構(gòu)3. 數(shù)據(jù)流體系結(jié)構(gòu)Data Flow Architectures8/6/20221Styles -Moving from Qualities toArchitecturesArchitectural styles help software engineers to reason about architectural qualities.體系結(jié)構(gòu)風(fēng)格幫助軟件工程師推斷軟件體系結(jié)構(gòu)的質(zhì)量8/6/20222Styles -Moving from Qualities toArchitecturesA styledescribes a class of architectures描述一

2、類體系結(jié)構(gòu)is found repeatedly in practice在實(shí)踐中被多次設(shè)計(jì)、應(yīng)用is a package of design decisions是若干設(shè)計(jì)思想的綜合has known properties that permit reuse具有已經(jīng)被熟知的特性,并且可以復(fù)用8/6/20223Architectural StylesA style is determined (described) bya set of component types (e.g., data repository, process, object)一組組件類型(例如:數(shù)據(jù)容器,過程,對象)a se

3、t of connector types/interaction mechanisms (e.g., subroutine call, event, pipe)一組連接件類型/交互機(jī)制(例如:過程調(diào)用,事件,管道)a topological layout of these components這些組件的拓?fù)浞植?/6/20224Architectural StylesA style is determined (described) bya set of constraints on topology and behavior (e.g., a data repository is not a

4、llowed to change stored values, pipelines are acyclic)一組對拓?fù)浜托袨榈募s束(例如:數(shù)據(jù)容器不能自己改變數(shù)據(jù),管道不能是循環(huán)的an informal description of the costs and benefits of the style, e.g.: “Use the pipe and filter style when reuse is desired and performance is not a top priority一些對風(fēng)格的成本和益處的非正式的描述,例如:如果你需要重用性并且性能不是很重要,那么可以使用管道風(fēng)格

5、8/6/20225Architectural StylesGarlan and Shaw compiled a catalog of architectural styles in 1995. Others, such as Buschmann, have augmented this.There is no complete list. 沒有完備的列表There is no unique, non-overlapping list. 沒有無重疊的列表Styles overlap. 風(fēng)格是彼此重疊的Systems exhibit multiple styles at once. 一個(gè)系統(tǒng)通常表

6、現(xiàn)出多種風(fēng)格8/6/20226Types of Architectural Styles8/6/20227Notes about Architectural StylesWhen we introduce a new style, we will typically first examine its “pure” form.pure architectural style are rarely found in practice純粹的體系風(fēng)格在實(shí)際中很難遇到systems in practiceregularly deviate from the academic definitions o

7、f these systems. 循規(guī)蹈矩地背離了對這些系統(tǒng)的學(xué)術(shù)定義typically feature many architectural styles simultaneously典型地,融合很多體系風(fēng)格的特色as an architect you must understand the “pure” styles to understand the strength and weaknesses of the style as well as the consequences of deviating from the style作為一個(gè)架構(gòu)師,你必須理解“純”的風(fēng)格。理解它的優(yōu)點(diǎn)與缺

8、陷,也要理解背離此種風(fēng)格之后會(huì)帶來什么結(jié)果8/6/20228Data Flow Style(數(shù)據(jù)流風(fēng)格)A data flow system is one in whichthe availability of data controls the computation由數(shù)據(jù)控制計(jì)算the structure of the design is dominated by orderly motion of data from process to process系統(tǒng)結(jié)構(gòu)由數(shù)據(jù)在處理之間的有序移動(dòng)決定the pattern of data flow is explicit數(shù)據(jù)流系統(tǒng)的結(jié)構(gòu)是顯而易見

9、的In a pure data flow system, there is no other interaction between processes在純數(shù)據(jù)流系統(tǒng)中,處理之間除了數(shù)據(jù)交換,沒有任何其他的交互8/6/20229The Data Flow StyleThere are variety of variations on this genera theme:how control is exerted (e.g., push versus pull)如何施加控制(比如:推還是拉)degree of concurrency between processes并行的程度topology

10、8/6/202210Data Flow StylesComponents: Data Flow ComponentsInterfaces are input ports and output ports組件接口是輸入端口和輸出端口Input ports read data; output ports write data從輸入端口讀數(shù)據(jù),向輸出端口寫數(shù)據(jù)Computational model: read data from input ports, compute, write data to output ports計(jì)算模型:從入口讀數(shù),計(jì)算,然后寫到出口8/6/202211Data Flo

11、w StylesConnectors: Data StreamsUni-directional(單向)usually asynchronous, buffered (通常是異步的,有緩沖)Interfaces are reader and writer roles接口是reader和writer計(jì)算模型: 把數(shù)據(jù)從writer轉(zhuǎn)向readerSystemsArbitrary graphs(任意拓?fù)浣Y(jié)構(gòu))Computational model: functional composition(計(jì)算模型: 功能組合)8/6/202212Patterns of Data Flow in Systems

12、In general, data can flow in arbitrary patterns(一般情況,數(shù)據(jù)的流向無序)Often we are primarilyinterested in nearly linear data flow systems(我們主要研究近似線性數(shù)據(jù)流)or in very simple, highly constrained cyclic structures(或者是在限度內(nèi)的循環(huán)數(shù)據(jù)流)8/6/202213Control Flow vs. Data FlowControl Flow (typical case in procedural systems)Do

13、minant question is how locus of control moves through the program主要問題是控制點(diǎn)怎樣在程序或系統(tǒng)之間移動(dòng)Data may accompany the control but is not the driving force數(shù)據(jù)可能跟著控制走,但是并不起推動(dòng)系統(tǒng)運(yùn)轉(zhuǎn)的作用Primary reasoning is about order of computation關(guān)注的核心是計(jì)算順序8/6/202214Control Flow vs. Data FlowData FlowDominant question is how data

14、moves through a collection of (atomic) computations主要問題是數(shù)據(jù)怎樣在運(yùn)算單元之間流動(dòng)As data moves, control is “activated”數(shù)據(jù)到了,控制(計(jì)算)單元便開始工作We reason about data availability, transformations, latency,我們關(guān)心數(shù)據(jù)是否可用,轉(zhuǎn)換,潛伏8/6/202215Three Examples of Data FlowBatch Sequential(批處理)Pipe-and-Filter(管道)Process Control(控制)8/6/

15、202216Batch Sequential Pattern8/6/202217Characteristics of Batch Sequential SystemsProcessing steps are independent programs每個(gè)處理步驟是一個(gè)獨(dú)立的程序Each step runs to completion before next step starts每一步必須在前一步結(jié)束后才能開始Data transmitted as a whole between steps數(shù)據(jù)必須是完整的,以整體的方式傳遞Typical applications:classical data

16、processingprogram compilation/computer aided software engineering8/6/202218Characteristics of Batch Sequential SystemsArchitectural Heuristicscomponents (processing steps) are independent programsconnectors are some type of media - traditionally magnetic tapeeach step runs to completion before the n

17、ext step begins8/6/202219Example: Batch Sequential SystemsCompilersearly compilers began as essentially batch sequential systemslexical analysis, parsing, semantic analysis, code generationinitially a mechanism to turn higher level source code into object codeComputer Aided Software EngineeringCASE

18、tools initially provided an environment to write and compile source code into object codecompiler, library, linker, make, into an integrated toolearly tools were independent programslater tools shared only filescommon formats, simple sharing mechanisms, scriptseventually tools grew to include design

19、, documentation, configuration control, and even automatic code generation8/6/202220Three Examples of Data FlowBatch Sequential(批處理)Pipe-and-Filter(管道)Process Control(控制)8/6/202221Pipe-and-Filter8/6/202222Pipes and FiltersRole of (“pure”) filtersreads streams of data as input, produces streams of da

20、ta as outputtraditionally byte-orientedperforms stream-to-stream transformationsenrich data by computation and adding information通過計(jì)算和增加信息豐富數(shù)據(jù)refine by distilling data or removing irrelevant data通過濃縮和刪除精煉數(shù)據(jù)transform data by changing its representation通過改變記錄方式轉(zhuǎn)化數(shù)據(jù)8/6/202223Pipes and Filtersincrementa

21、lly transform data from the source to the sink(遞增地轉(zhuǎn)化數(shù)據(jù))data is processed as it arrives, not gathered then processed數(shù)據(jù)到來時(shí)便被處理,不是收集然后處理(偶有例外)filters are independent entitiesno context in processing streamsno state preservation between instantiationsno knowledge of upstream/downstream filtersthe correc

22、tness of the output should not depend upon the order in which the pipes are connected in a pipe-and-filter network過濾器的先后順序不影響輸出的結(jié)果8/6/202224Pipe-and-FilterRole of (“pure”) pipes (SG96)move data from a filter output to a filter input (or to a device or file)data moves in one direction, upstream flow

23、control is allowedpipes form data transmission graphsOverall Operationsystem action is mediated by data delivery數(shù)據(jù)傳送引起系統(tǒng)動(dòng)作pipe-and-filter systems run until no more data is available and no more computations possible8/6/202225“Pipes” and “Filters” in unixunix processes that transform stdin to stdout

24、are generally called filtersbut when they consume all the input before starting the output, they violate the filter assumptionsort, for exampleunix pipes can treat files as well as filters as data sources and sinksbut files are passive, so you cant make arbitrary combinationsunix assumes that the pi

25、pes carry ASCII character streamsthe good news: anything can connect to anything elsethe bad news: everything must be encoded in ASCII, then shipped, then decoded8/6/202226“Pipes” and “Filters” in unix8/6/202227Issue: Data Pulling and Data PushingQuestion: what is the force that makes the data flow?

26、Three choices, all with force emanating from filters:push: data source pushes data in downstream directionpull: data sink pulls data from upstream directionpush/pull: a filter is actively pulling from upstream, computing, and pushing downstreampassive: dont do either, act as a sink for dataCombinati

27、ons may be complex. If more than one filter is pushing/pulling, synchronization is neededSo: Why cant you pipe a a unix?8/6/202228Batch Sequential vs Pipe & Filter8/6/202229Batch Sequential vs Pipe & Filter (UNIX)BothDecompose task into fixed sequence of computations Interact only through data passe

28、d from one to another把任務(wù)分解成為一系列固定順序的計(jì)算單元(組件),組件間只通過數(shù)據(jù)傳遞交互8/6/202230Batch Sequential vs Pipe & Filter (UNIX)Batch SequentialPipe/FiltertotalincrementalHigh latency (real-time is hard)Results start immediatelyRandom access to input okProcessing localized in inputNo concurrencyFeedback loops possibleNo

29、n-interactiveOften interactive, awkwardly8/6/202231A Variant on Data FlowIssue: in some systems,Data flows slowly through the systemData does not remain strictly in order8/6/202232Summary: Guidance for Selecting a Data Flow Styletask is dominated by the availability of data任務(wù)由數(shù)據(jù)主導(dǎo)data can be moved predictably from process to process事先知道數(shù)據(jù)的確切流向pipe-and-filter architectures are good choices for many data flow applicati

溫馨提示

  • 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

提交評論