How it works · 38 of 49 Core

What is the pipes and filters architecture pattern?

A line of small, swappable steps (Unix pipes)

Pipes & filters: Pipes and filters builds a job as a line of small, independent steps that each read one kind of input and write the same kind of output, joined by pipes that only carry data. Add, swap or reorder a step without touching the others, as long as each still gets the fields it needs.

Loading the animation…

Say it like this Pipes and filters builds a job as a line of small, independent steps that each read one kind of input and write the same kind of output, so you can add, swap or reorder a step without touching the others, as long as each step still gets the fields it needs.

Under the hood — for builders
Worked example: the card's line
The stations are one shell line: grep ' 404 ' access.log | grep -v ' bot$' | cut -d' ' -f1 | sort | uniq -c. Each program reads lines and writes lines; "|" is the pipe. Adding the bot filter meant inserting one command; no other command changed.
The source, in its words
Garlan and Shaw, "An Introduction to Software Architecture", 1994: "each component has a set of inputs and a set of outputs"; "filters must be independent entities: in particular, they should not share state with other filters"; "filters do not know the identity of their upstream and downstream filters"; "new filters can be added to existing systems and old filters can be replaced by improved ones."
Terms
Filter: a step that reads a stream, changes it and writes a stream. Pipe: the connector that carries one filter's output to the next filter's input. Pipeline: filters in one straight line. Stream: data handled piece by piece as it arrives, not all at once. Blocking step: one, like sort, that needs all its input before its first output.
Run here: order is the contract
The same three filters in a different order give a different answer, and no error. After cut, each line holds only the page, so "drop bots" finds nothing to drop.
Run here: all at once, or one step at a time?
Same job, piped (every filter running at once) vs step by step (each writes a file the next reads): 0.09–0.10 s piped vs 0.11–0.12 s step by step, identical output; step by step also wrote 10 MB of temporary files. Seeds 1–3, 4-core machine. The gain is small because sort waits for the whole stream either way.
Where you meet it
Unix shell lines (Garlan and Shaw's "best known examples"); compilers, whose phases they call "lexical analysis, parsing, semantic analysis, code generation"; and, their other examples, "signal processing domains", "functional programming" and "distributed systems".
Measure it
Time and rows per step · which step blocks (sort, group by, totals) · rows dropped per filter, so a filter that drops nothing is noticed · time to the first output.
Watch out
Garlan and Shaw: pipelines "are typically not good at handling interactive applications" and may "force a lowest common denominator on data transmission", so every step parses and re-writes text. Write down what each step needs on its input; a misplaced filter fails silently.
Sources
David Garlan and Mary Shaw, "An Introduction to Software Architecture", CMU-CS-94-166, January 1994, §3.1, read in session · our runs, GNU coreutils and grep on a generated log, 21 Nov 2026.

What happens in the pipes & filters animation, step by step?

  1. Pipes and filters: each station does one job and hands the same kind of card to the next. Muddy log lines go in; a clean count of errors per page comes out.
  2. Your turn: the count includes bots. Drag the "drop bots" station into a gap in the line.
  3. A new station, and nothing else touched: bot lines drop out and the count falls from 6 to 3. Before "cut", because after it the card no longer says who sent it.
  4. Every station works at once, each on a different card. Except sort: it must see the last card before it can let the first one go.
  5. The belt here is dumb: it only carries cards, and all the know-how sits in the stations. Put the know-how in the middle instead, rewriting every message: next, the enterprise service bus.

What everyday example explains pipes & filters?

A car wash: soak, scrub, rinse, dry, and you can add wax without rebuilding it. The belt only carries cars; each station knows one job. Wax before the rinse is wasted, so order still matters.

Why should a team care about pipes & filters?

Any job that is a chain of transformations (logs, imports, media, a compiler) can be one big program or a line of small steps; the line lets you change one step safely, but only if the format between steps is written down.