Un handler qui n'existe que pour débiter une carte finit par authentifier, limiter, journaliser, valider, tracer — six préoccupations transverses entrelacées avec sa seule ligne de métier, recopiées dans chaque endpoint. La Chain of Responsibility — dont le middleware HTTP est une incarnation — sort chaque transverse dans un maillon autonome : la requête traverse une chaîne explicite, et le cœur n'est que le dernier maillon. On gagne réutilisation, test du cœur seul, ordre lisible. Le prix subtil : la chaîne devient si pratique qu'on y cache le flux de contrôle. Le middleware enveloppe la requête, il ne décide pas du métier.A handler that exists only to charge a card ends up authenticating, throttling, logging, validating, tracing — six cross-cutting concerns interwoven with its single business line, recopied in every endpoint. The Chain of Responsibility — of which HTTP middleware is one incarnation — lifts each concern into a standalone link: the request crosses an explicit chain, and the core is just the last link. You gain reuse, testing the core alone, a readable order. The subtle price: the chain becomes so convenient you hide control flow in it. Middleware wraps the request, it doesn't decide the domain.
Le premier numéro est libre. Débloque tout The Architecture Loop — tous les volumes, à vie — pour 5 €, paiement unique.The first issue is free. Unlock all of The Architecture Loop — every volume, forever — for €5, one-time.