Files
ProcessControl/07-part-vii-mediation.qmd
T

136 lines
11 KiB
Plaintext

# [Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de} {#sec-part-vii}
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
::: {.en}
Two mediators were removed and the gain was measured. Steps 48 to 52 answer the obvious next question: does that make mediation wrong? No — and the distinction that decides it is sharp enough to apply to a design you have never seen.
:::
::: {.fr}
Deux médiateurs ont été supprimés et le gain mesuré. Les étapes 48 à 52 répondent à la question suivante, évidente : la médiation est-elle pour autant mauvaise ? Non — et la distinction qui tranche est assez nette pour s'appliquer à une conception qu'on n'a jamais vue.
:::
::: {.de}
Zwei Vermittler wurden entfernt und der Gewinn gemessen. Die Schritte 48 bis 52 beantworten die naheliegende nächste Frage: ist Vermittlung damit falsch? Nein — und die entscheidende Unterscheidung ist scharf genug, um sie auf einen fremden Entwurf anzuwenden.
:::
## [A transformer earns its existence]{.en}[Un transformateur mérite d'exister]{.fr}[Ein Transformator verdient seine Existenz]{.de} {#sec-transformer}
::: {.en}
What was removed was a mediator computing `A → A`: an expensive identity function, in the availability chain, copying every message without adding meaning.
Now take a producer publishing `{"value":"Hello"}` and a consumer expecting a display structure. A `TextToDisplayTransformer` between them contributes schema transformation, semantic adaptation, possibly unit conversion, possibly aggregation. That is work neither side should own: ROT13 is not meant to decide terminal colours, and the console is not meant to understand ROT13's payload shape.
The line is drawn by **contract compatibility**, not by whether something is added. A mediator converting Celsius to Fahrenheit changes rather than adds and has earned its place; one appending a timestamp to a message the consumer already understands has added something and is still suspicious. The question is always: could the consumer read the producer's message as it stands?
> If a consumer semantically understands a producer's publication, direct subscription is often sufficient.
> If the contracts are incompatible, introduce a transformer that performs an actual adaptation.
>
> A mediator that merely forwards compatible data is suspicious. A mediator that adds necessary semantics has earned its existence.
:::
::: {.fr}
Ce qui a été supprimé, c'est un médiateur calculant `A → A` : une fonction identité coûteuse, dans la chaîne de disponibilité, copiant chaque message sans rien y ajouter.
Prenons maintenant un producteur publiant `{"value":"Hello"}` et un consommateur attendant une structure d'affichage. Un `TextToDisplayTransformer` entre les deux apporte transformation de schéma, adaptation sémantique, éventuellement conversion d'unités, éventuellement agrégation. C'est un travail qu'aucun des deux ne devrait porter : ROT13 n'a pas à décider des couleurs du terminal, et la console n'a pas à comprendre la forme de la charge utile de ROT13.
La ligne se trace par la **compatibilité des contrats**, non par le fait d'ajouter quelque chose. Un médiateur convertissant des Celsius en Fahrenheit modifie au lieu d'ajouter et mérite sa place ; un médiateur ajoutant un horodatage à un message que le consommateur comprend déjà a ajouté quelque chose et reste suspect. La question est toujours : le consommateur pourrait-il lire le message du producteur tel quel ?
> Si un consommateur comprend sémantiquement la publication d'un producteur, l'abonnement direct suffit souvent.
> Si les contrats sont incompatibles, introduire un transformateur qui effectue une adaptation réelle.
>
> Un médiateur qui ne fait que transmettre des données compatibles est suspect. Un médiateur qui ajoute la sémantique nécessaire mérite d'exister.
:::
::: {.de}
Entfernt wurde ein Vermittler, der `A → A` berechnete: eine teure Identitätsfunktion in der Verfügbarkeitskette, die jede Nachricht ohne Bedeutungsgewinn kopierte.
Nun ein Produzent, der `{"value":"Hello"}` veröffentlicht, und ein Konsument, der eine Anzeigestruktur erwartet. Ein `TextToDisplayTransformer` dazwischen leistet Schematransformation, semantische Anpassung, möglicherweise Einheitenumrechnung, möglicherweise Aggregation. Das ist Arbeit, die keine der beiden Seiten besitzen sollte: ROT13 hat nicht über Terminalfarben zu entscheiden, und die Konsole hat die Nutzlastform von ROT13 nicht zu verstehen.
Die Grenze zieht die **Vertragskompatibilität**, nicht die Frage, ob etwas hinzukommt. Ein Vermittler, der Celsius in Fahrenheit umrechnet, ändert statt hinzuzufügen und hat seinen Platz verdient; einer, der einer schon verstandenen Nachricht einen Zeitstempel anhängt, hat etwas hinzugefügt und bleibt verdächtig. Die Frage ist immer: könnte der Konsument die Nachricht des Produzenten so lesen, wie sie ist?
> Versteht ein Konsument die Veröffentlichung eines Produzenten semantisch, genügt direktes Abonnieren oft.
> Sind die Verträge inkompatibel, führe einen Transformator ein, der eine echte Anpassung leistet.
>
> Ein Vermittler, der nur kompatible Daten weiterleitet, ist verdächtig. Ein Vermittler, der nötige Semantik hinzufügt, hat seine Existenz verdient.
:::
## [The transformer is egoistic too]{.en}[Le transformateur est égoïste aussi]{.fr}[Auch der Transformator ist egoistisch]{.de} {#sec-egoistic-transformer}
::: {.en}
Inserted into the chain, the transformer subscribes to `rot13/outbox` and publishes to **its own** outbox; ConsoleOut then subscribes to the transformer's outbox instead of ROT13's. Note what that costs in code: **nothing**. ConsoleOut receives a different Intent — `TOPIC display/outbox` rather than `TOPIC rot13/outbox` — and the chain is rewired. ROT13 never learns the transformer exists; the transformer never learns ConsoleOut exists.
Why not let it publish straight into `consoleOut/inbox`, saving a mailbox? Four reasons:
- **knowledge** — it would contain ConsoleOut's name, which is topology inside a service, the relapse of step 28;
- **ownership** — that inbox is ConsoleOut's control channel, written by the configurator; payload from the transformer would give it two authorities;
- **reach** — its own outbox can be read by a logger, a web view or a second display at no cost, while one inbox serves exactly one consumer;
- **mutability** — an aggregator can later be inserted after it by sending one different Intent, with no component edited.
:::
::: {.fr}
Inséré dans la chaîne, le transformateur s'abonne à `rot13/outbox` et publie dans **sa propre** boîte de sortie ; ConsoleOut s'abonne alors à celle du transformateur plutôt qu'à celle de ROT13. Notez ce que cela coûte en code : **rien**. ConsoleOut reçoit un autre Intent — `TOPIC display/outbox` au lieu de `TOPIC rot13/outbox` — et la chaîne est recâblée. ROT13 n'apprend jamais que le transformateur existe ; le transformateur n'apprend jamais que ConsoleOut existe.
Pourquoi ne pas publier directement dans `consoleOut/inbox`, en économisant une boîte ? Quatre raisons :
- **connaissance** — il contiendrait le nom de ConsoleOut, c'est-à-dire de la topologie dans un service, la rechute de l'étape 28 ;
- **propriété** — cette boîte est le canal de contrôle de ConsoleOut, écrit par le configurateur ; une charge utile venue du transformateur lui donnerait deux autorités ;
- **portée** — sa propre boîte peut être lue par un journal, une vue web ou un second affichage sans frais, alors qu'une boîte d'entrée ne sert qu'un consommateur ;
- **mutabilité** — un agrégateur peut être inséré ensuite en envoyant un autre Intent, sans modifier aucun composant.
:::
::: {.de}
In die Kette eingefügt, abonniert der Transformator `rot13/outbox` und veröffentlicht in **sein eigenes** Ausgangspostfach; ConsoleOut abonniert dann dieses statt das von ROT13. Was das an Code kostet: **nichts**. ConsoleOut erhält einen anderen Intent — `TOPIC display/outbox` statt `TOPIC rot13/outbox` — und die Kette ist umverdrahtet. ROT13 erfährt nie, dass der Transformator existiert; der Transformator nie, dass ConsoleOut existiert.
Warum nicht direkt in `consoleOut/inbox` veröffentlichen und ein Postfach sparen? Vier Gründe:
- **Wissen** — er enthielte ConsoleOuts Namen, also Topologie in einem Dienst, der Rückfall von Schritt 28;
- **Besitz** — dieses Postfach ist ConsoleOuts Steuerkanal, geschrieben vom Konfigurator; Nutzlast vom Transformator gäbe ihm zwei Autoritäten;
- **Reichweite** — sein eigenes Ausgangspostfach kann ein Logger, eine Webansicht oder ein zweites Display kostenlos lesen, während ein Eingangspostfach genau einen Konsumenten bedient;
- **Veränderbarkeit** — ein Aggregator lässt sich danach durch einen anderen Intent einfügen, ohne eine Komponente zu ändern.
:::
## [The complete filesystem architecture]{.en}[L'architecture complète sur système de fichiers]{.fr}[Die vollständige Dateisystem-Architektur]{.de} {#sec-complete-filesystem}
::: {.en}
Every mailbox with exactly one writer:
| mailbox | single writer |
|---|---|
| `consoleIn/outbox` | SensorService |
| `rot13/outbox` | ProcessorService |
| `display/outbox` | the transformer |
| every control inbox | the configurator — the one designated Intent authority |
| the terminal | ActuatorService, which writes no mailbox at all |
Egoistic capabilities, Intent from one authority, a transformer only where contracts differ, one writer per resource, and the topology nowhere in the capabilities. That is the design the filesystem was good enough to teach — and the next part asks what the filesystem itself is no longer good enough for.
:::
::: {.fr}
Chaque boîte avec exactement un écrivain :
| boîte | écrivain unique |
|---|---|
| `consoleIn/outbox` | SensorService |
| `rot13/outbox` | ProcessorService |
| `display/outbox` | le transformateur |
| chaque boîte de contrôle | le configurateur — l'unique autorité d'Intent désignée |
| le terminal | ActuatorService, qui n'écrit aucune boîte |
Des capacités égoïstes, l'Intent venant d'une seule autorité, un transformateur seulement là où les contrats diffèrent, un écrivain par ressource, et la topologie nulle part dans les capacités. C'est la conception que le système de fichiers a suffi à enseigner — et la partie suivante demande à quoi le système de fichiers, lui, ne suffit plus.
:::
::: {.de}
Jedes Postfach mit genau einem Schreiber:
| Postfach | einziger Schreiber |
|---|---|
| `consoleIn/outbox` | SensorService |
| `rot13/outbox` | ProcessorService |
| `display/outbox` | der Transformator |
| jedes Steuerpostfach | der Konfigurator — die eine bestimmte Intent-Autorität |
| das Terminal | ActuatorService, der kein Postfach schreibt |
Egoistische Fähigkeiten, Intent aus einer Autorität, ein Transformator nur dort, wo Verträge sich unterscheiden, ein Schreiber pro Ressource, und die Topologie nirgends in den Fähigkeiten. Das ist der Entwurf, den das Dateisystem gut genug war zu lehren — und der nächste Teil fragt, wofür das Dateisystem selbst nicht mehr gut genug ist.
:::