Architecture · Software

Pipes and Filters

Pipe and filter architecture, which is a type of data flow architecture. Data flow architecture considers a system as simply a series of transformation on sets of data. Data is transformed from one form to another using different types of operations. A pipe and filter architecture has independent entities called filters which perform transformations on data input they receive, and pipes, which serve as connectors for the stream of data being transformed. 

PIpeAndFiltersDiagram.png
THe Pipe and Filter diagram

The changes to the data are done sequentially from filter to filter. Each filter performs its local transformation on the data input it receives from the previous pipe and then it sends the output onto the next pipe.

UML Component diagram for pipe and filters:

PipeAndFiltersComponentDiagram.png
Pipe and filters component diagram.

the data source can be connected to a number of different filters. Each filter has a required interface to receive input from data sources and other filters. But each also have a provided interface that will output transformed data. The data target is connected to receive the fully transformed result.

Advantages:

  1. Loose coupling of components. allows changes on individual filters to be made easily without affecting other filters in the system
  2. Reusability – each filter can be called and used over and over again with different inputs.

Drawbacks:

  1. Performance: it may reduce performance due to excessive overheads in filters. As more and more filters are added, the performance of the system will rapidly diminish.
  2. Waiting time: this architecture may cause filters to get overloaded with massive amounts of data to process. While one filter is working hard to process the large amount of data, other filters may be starved waiting for their inputs.
  3. Interactive apps: cannot be used for interactive applications. The data transfers and transformations will take time depending on the amount of data transmitted. So this type of architecture is not suitable for applications that require rapid responses.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.