Pipe-and-Filter Pattern
Updated 2026-08-13
Summary
The pipe-and-filter pattern decomposes a processing task into independent filters that each perform one transformation, with data flowing between them through pipes.
Definition
The pipe-and-filter pattern is an architectural style in which a processing task is decomposed into a sequence of independent filters, each performing a single transformation on its input stream, connected by pipes that carry data from one stage to the next. Its core proposition is that separating concerns this way makes each stage independently testable, replaceable, and reusable, and lets a pipeline be recomposed by reordering or substituting stages. The key qualification is that filters should be stateless with respect to the stream, since shared or hidden state between stages breaks composability and makes the pipeline's behavior depend on execution order.
Introduction
How to use
- Step decomposition: break a tangled transformation into a chain of single-purpose steps. - Reuse check: extract any step that appears in several workflows into a reusable filter. - Interface contract: define the data format passed between stages before writing the stages.
Mechanism
Complex transformations are hard to reason about as a whole, while each single-purpose step is easy to verify. Restricting communication to a uniform stream through pipes keeps stages decoupled, so a change inside one filter cannot silently alter another. Composability then follows from the shared interface rather than from coordination between stages.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- Unix pipelines compose small utilities, as when grep, sort, and uniq are chained with vertical bars.
- Compiler front ends run source code through lexical analysis, parsing, and semantic analysis stages in sequence.
Common pitfalls
- Letting filters share hidden state, which couples stages and destroys the reusability the pattern is meant to provide.
- Applying the pattern to interactive or stateful workflows, where the uniform stream assumption forces awkward workarounds.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Pipeline_(softwareverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS