Difference between layers and pipes and filters?

What is the difference between these two design patterns? It seems to me very similar to me, one processor (layer or filter) performs some data processing and pushes / pushes data to another processor. The unit ninteracts only with the module n+1and n-1, there are interfaces that define the functionality offered by one particular device.

What is the difference?

Edit: maybe one difference should be the data stream. In the layer there may be top-down, bottom-upand / or a connection betweenwithin some layers. In Pipes and filters, the data flow starts from one 1and goes to the block n(not back).

+6
source share
4 answers

The organization is wise, it may look like layers, and the patterns of pipes and filters are similar (one component receives input and passes the result to another), but they are not functionally. These are architectural patterns.

If we get to the definition :

Pipe and filter patterns divide a large processing task into a sequence of smaller independent processing steps (Filters) that are connected by channels (Pipes).

While in the Layer Pattern, each layer communicates with neighboring layers and is responsible for some processing of its own, transferring requests to the underlying layer and responding to requests from the layer above it.

Comparison :

, , . - , .

, ( ), .

, , , , .

. , , , .

, .

+8
  1. , .. () API.

    / ( ) / ( ). , / (, stdout, stderr Unix).

  2. : , , , , .. .

    . .

  3. , , .

    , .

  4. API , , - . .

    , , . .

  5. , .

    . , , .

  6. : TCP/IP, , - ..

    : Unix-, ..

0
  1. , .. () API.

    / ( ) / ( ). , /.

  2. : , , , , .. .

    . .

  3. , , .

    , .

  4. , .

    . , , .

  5. : TCP/IP, , - ..

    : Unix-, ..

0

, , .

( /) , . - .

( ) .

-1

Source: https://habr.com/ru/post/1584711/


All Articles