1 / 27

Topic

Topic. Architectural Patterns Pipe and Filter. Mud to Structure. Pipes & filters. Pipes and Filters.

symona
Download Presentation

Topic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Topic Architectural Patterns Pipe and Filter

  2. Mud to Structure Pipes & filters

  3. Pipes and Filters The pipes and filters architectural pattern provides a structure for systems that process a stream of data. Each processing step is encapsulated in a filter component. Data is passed through pipes between adjacent filters. Recombining filters allows you to build families of related systems.

  4. Pipes and Filters • Type of Data Flow Architecture • Filter is a component and pipe is a connector • Filter has interfaces from which a set of inputs can flow in and a set of outputs can flow out. • Incremental transformation of data by successive components. • All data does not need to be processed for next filter to start working. • Any set of filters may be combined in any order, although reasonable semantics are not guaranteed by this style.

  5. Pipes and Filters Filter • Independent entities • Does not share state with other filters. • Do not know the identity to upstream and downstream filters. Pipes • Stateless data stream • Source end feeds filter input and sink receives output.

  6. Pipes and Filters

  7. Pipes and Filters Compilers Various “translation” systems

  8. Pipes and Filters – 3 part schema

  9. Pipes and Filters Class Filter • Collaborators • Pipe • Responsibility • Gets inputs data • Performs a function on its input data • Supplies output data Filter component is a processing units of the pipeline Enriches, refines or transforms its input data Enriches – computing and adding information Refine – concentrating or extracting information Transforms – delivering data in some other representation

  10. Pipes and Filters Class Pipe • Collaborators • Data Source • Data Sink • Filter • Responsibility • Transfers data • Buffers data • Synchronizes active neighbors Pipe denotes connection between filters Data source and first filter Last filter and Data sink Synchronises two active component

  11. Pipes and Filters Class Data Source • Collaborators • Pipe • Responsibility • Delivers input to processing pipeline Data source represents input to the system Sequence of data of the same structure or type

  12. Pipes and Filters Class Data Sink • Collaborators • Pipe • Responsibility • Consumes output Data sink collects results from end of the pipeline Active: pulls results from preceding processing stage Passive: allows preceding filter to push or write the results into it

  13. Dynamics • Scenario I • Push pipeline [Activity starts with the Data source] • Filter activity started by writing data to the filters • Passive Filter [Use direct calls to the adjacent pipeline]

  14. Dynamics • Scenario II • Pull pipeline • Control flow is started by the data sink calling for data

  15. Dynamics • Scenario III • Push-pull mixed pipeline

  16. Dynamics • Scenario IV • All filters actively pull, compute and push data in a loop • Each filter runs its own thread of control • Filters are synchronised by buffering pipe between them

  17. Implementation

  18. 1: Divide the systems tasks into sequence of processing stages Each stage must depend on the output of the predecessor All stages conceptually connected by data flow

  19. 2: Define data format to be passed along each pipe Define a uniform format results in the highest flexibility because it makes recombination of filters easy Define the end of input marking

  20. 3: Decide how to implement each pipe connection Decision determines active or passive filter Using a separate pipe mechanism that synchronises adjacent active filters provide a more flexible solution

  21. 4: Design and implement the filters • Depends on • Task it must perform • Adjacent pipe • Active or Passive filters • Performance and tradeoffs • Filter reuse

  22. 5: Design the error handling Never neglect error handling No global state shared; error handling hard to address Strategies in case of error – depend on domain

  23. 6: Setup the processing pipeline Use of standardised main program Use of user inputs or choice

  24. Variants • Tee and Join pipeline • Filters with more then one input and/or more than one output

  25. Benefits No intermediate files necessary, but possible Flexibility by filter exchange Flexibility by recombination Reuse of filter components Rapid prototyping of pipelines Efficiency by parallel processing

  26. Liabilities Sharing state information is expensive or inflexible Data transformation overhead Error handling

  27. Known Uses Find (at least 2) more popular uses and document them

More Related