{"id":"6b08bd3a80884893657cc9aa","slug":"mediator","title":"Mediator: components talk through a coordinator","summary":"The Mediator pattern through the order form of a pierogi place: the delivery choice, address, time slot and button do not know each other, and the rules of their cooperation live in one place. Plus an honest look at MediatR and code in five languages.","servedLang":"en","availableLangs":["pl","en"],"topics":["mediator","cqrs"],"techs":["dotnet","typescript","java","go","python"],"tags":["gof","behavioral","mediator","ui","mediatr","coupling"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":12,"stats":{"views":3,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:14:02.221Z","updatedAt":"2026-11-27T13:08:01.539Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"violet","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"The Mediator design pattern in C#, TypeScript, Java, Go and Python: coordinating form components, a mesh of dependencies vs a star, MediatR and when you do not need it.","wordCount":2373,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"The order form on the website of Halina's pierogi place has four elements: a \"pickup/delivery\" toggle, an address field, a time slot picker and an \"Order\" button. It sounds simple until it turns out that everything affects everything: delivery shows the address and changes the time slots, and the button depends on all three. "},{"type":"text","text":"Mediator","marks":[{"type":"bold"}]},{"type":"text","text":" takes this knowledge away from the components and keeps it in one object."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Components ("},{"type":"text","text":"colleagues","marks":[{"type":"italic"}]},{"type":"text","text":") "},{"type":"text","text":"do not refer to each other","marks":[{"type":"bold"}]},{"type":"text","text":" – they report changes to the mediator."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The mediator knows all participants and "},{"type":"text","text":"centralises the rules of their cooperation","marks":[{"type":"bold"}]},{"type":"text","text":"."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"An \"everyone with everyone\" mesh of dependencies becomes a star: everyone only knows the centre."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"4","label":"form components","hint":"toggle, address, time slot, button"},{"value":"12 → 4","label":"possible dependencies","hint":"an all-to-all mesh vs a star"},{"value":"1","label":"place for the rules","hint":"the mediator's notify method"}]}},{"type":"heading","attrs":{"level":2,"id":"the-problem-a-mesh-of-dependencies"},"content":[{"type":"text","text":"The problem: a mesh of dependencies"}]},{"type":"paragraph","content":[{"type":"text","text":"The first version of the form wired reactions directly to the components:"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"order-form-before.ts"},"content":[{"type":"text","text":"deliveryToggle.onChange = (mode) => {\n  addressField.visible = mode === 'delivery';\n  slotPicker.load(mode === 'delivery' ? deliverySlots : pickupSlots);\n  submitButton.enabled = !!slotPicker.selected && (mode === 'pickup' || addressField.value !== '');\n};\naddressField.onChange = (value) => {\n  submitButton.enabled = !!slotPicker.selected && (deliveryToggle.mode === 'pickup' || value !== '');\n};\nslotPicker.onChange = (slot) => {\n  submitButton.enabled = !!slot && (deliveryToggle.mode === 'pickup' || addressField.value !== ''); // third copy\n};"}]},{"type":"paragraph","content":[{"type":"text","text":"The button's enabling condition exists in three copies and they already differ ("},{"type":"text","text":"!!slotPicker.selected","marks":[{"type":"code"}]},{"type":"text","text":" vs "},{"type":"text","text":"!!slot","marks":[{"type":"code"}]},{"type":"text","text":"). The toggle has to know the address, the slot list and the button; the address field has to know the toggle and the button. The components cannot be reused in another form, because each drags the others along. With four elements there are twelve possible connections – with eight there would be fifty-six."}]},{"type":"columns","attrs":{"layout":"1-1","valign":"top"},"content":[{"type":"column","content":[{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart TB\n  T[\"Toggle\"] <--> A[\"Address\"]\n  T <--> S[\"Time slot\"]\n  T <--> B[\"Button\"]\n  A <--> S\n  A <--> B\n  S <--> B","caption":"Without a mediator: everyone knows everyone"}}]},{"type":"column","content":[{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  T[\"Toggle\"] <--> M{{\"OrderForm (mediator)\"}}\n  A[\"Address\"] <--> M\n  M <--> S[\"Time slot\"]\n  M <--> B[\"Button\"]","caption":"With a mediator: a star"}}]}]},{"type":"heading","attrs":{"level":2,"id":"the-solution-a-single-coordinator"},"content":[{"type":"text","text":"The solution: a single coordinator"}]},{"type":"paragraph","content":[{"type":"text","text":"Every component gets a reference to the mediator and calls "},{"type":"text","text":"mediator.notify(this)","marks":[{"type":"code"}]},{"type":"text","text":" on every change. It does not know who will react or how. The mediator – here the "},{"type":"text","text":"OrderForm","marks":[{"type":"code"}]},{"type":"text","text":" itself – knows all the components and decides in one method what follows from what: choosing delivery shows the address and loads delivery slots, and every change recalculates the button's state."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"sequenceDiagram\n  actor U as Customer\n  participant T as DeliveryMode\n  participant M as OrderForm (mediator)\n  participant A as AddressField\n  participant S as SlotPicker\n  participant B as SubmitButton\n  U->>T: choose(\"pickup\")\n  T->>M: notify(this)\n  M->>A: visible = false\n  M->>S: options = pickup slots, selected = null\n  M->>B: enabled = false","caption":"The customer switches from delivery to pickup"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Role"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"In the example"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Responsibility"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Mediator"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"FormMediator","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the interface through which components report changes"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Concrete mediator"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"OrderForm","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"knows the components, holds the rules of their cooperation"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Colleague"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Component","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"only knows the mediator"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Concrete colleagues"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"DeliveryMode","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"AddressField","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"SlotPicker","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"SubmitButton","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"their own state and behaviour, unaware of the others"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"implementation-in-five-languages"},"content":[{"type":"text","text":"Implementation in five languages"}]},{"type":"paragraph","content":[{"type":"text","text":"The components are deliberately \"dumb\": they keep their state and report a change. All the dependency logic sits in the mediator's "},{"type":"text","text":"notify","marks":[{"type":"code"}]},{"type":"text","text":" method. In Go the button is simply a "},{"type":"text","text":"SubmitEnabled","marks":[{"type":"code"}]},{"type":"text","text":" field, and the mediator recognises the sender by its pointer."}]},{"type":"codeGroup","attrs":{"title":"Mediator – order form"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"OrderForm.cs"},"content":[{"type":"text","text":"var form = new OrderForm();\nform.Mode.Choose(\"delivery\");           // address shown, delivery slots loaded\nform.Address.Type(\"Długa 5\");\nform.Slots.Pick(\"18:30\");\nConsole.WriteLine(form.Submit.Enabled); // True\nform.Mode.Choose(\"pickup\");             // address hidden, slot reset\nConsole.WriteLine(form.Submit.Enabled); // False\n\npublic interface IFormMediator\n{\n    void Notify(Component sender);\n}\n\n// Components only know the mediator, never each other.\npublic abstract class Component(IFormMediator mediator)\n{\n    protected void Changed() => mediator.Notify(this);\n}\n\npublic sealed class DeliveryMode(IFormMediator m) : Component(m)\n{\n    public string Value { get; private set; } = \"pickup\";\n    public void Choose(string value) { Value = value; Changed(); }\n}\n\npublic sealed class AddressField(IFormMediator m) : Component(m)\n{\n    public bool Visible { get; set; }\n    public string Text { get; private set; } = \"\";\n    public void Type(string text) { Text = text; Changed(); }\n}\n\npublic sealed class SlotPicker(IFormMediator m) : Component(m)\n{\n    public string[] Options { get; set; } = [];\n    public string? Selected { get; set; }\n    public void Pick(string slot) { Selected = Options.Contains(slot) ? slot : null; Changed(); }\n}\n\npublic sealed class SubmitButton(IFormMediator m) : Component(m)\n{\n    public bool Enabled { get; set; }\n}\n\n// The mediator is the only place that knows how components affect each other.\npublic sealed class OrderForm : IFormMediator\n{\n    public DeliveryMode Mode { get; }\n    public AddressField Address { get; }\n    public SlotPicker Slots { get; }\n    public SubmitButton Submit { get; }\n\n    public OrderForm()\n    {\n        (Mode, Address, Slots, Submit) = (new(this), new(this), new(this), new(this));\n        Notify(Mode);\n    }\n\n    public void Notify(Component sender)\n    {\n        if (sender == Mode)\n        {\n            Address.Visible = Mode.Value == \"delivery\";\n            Slots.Options = Address.Visible ? [\"18:30\", \"19:00\"] : [\"17:45\", \"18:00\", \"18:15\"];\n            Slots.Selected = null;\n        }\n        Submit.Enabled = Slots.Selected is not null && (!Address.Visible || Address.Text.Length > 0);\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"order-form.ts"},"content":[{"type":"text","text":"interface FormMediator {\n  notify(sender: Component): void;\n}\n\n// Components only know the mediator, never each other.\nabstract class Component {\n  constructor(protected readonly mediator: FormMediator) {}\n  protected changed(): void { this.mediator.notify(this); }\n}\n\nclass DeliveryMode extends Component {\n  value: 'pickup' | 'delivery' = 'pickup';\n  choose(value: 'pickup' | 'delivery'): void { this.value = value; this.changed(); }\n}\n\nclass AddressField extends Component {\n  visible = false;\n  text = '';\n  type(text: string): void { this.text = text; this.changed(); }\n}\n\nclass SlotPicker extends Component {\n  options: string[] = [];\n  selected: string | null = null;\n  pick(slot: string): void { this.selected = this.options.includes(slot) ? slot : null; this.changed(); }\n}\n\nclass SubmitButton extends Component {\n  enabled = false;\n}\n\n// The mediator is the only place that knows how components affect each other.\nclass OrderForm implements FormMediator {\n  readonly mode = new DeliveryMode(this);\n  readonly address = new AddressField(this);\n  readonly slots = new SlotPicker(this);\n  readonly submit = new SubmitButton(this);\n\n  constructor() { this.notify(this.mode); }\n\n  notify(sender: Component): void {\n    if (sender === this.mode) {\n      this.address.visible = this.mode.value === 'delivery';\n      this.slots.options = this.address.visible ? ['18:30', '19:00'] : ['17:45', '18:00', '18:15'];\n      this.slots.selected = null;\n    }\n    this.submit.enabled = this.slots.selected !== null && (!this.address.visible || this.address.text !== '');\n  }\n}\n\nconst form = new OrderForm();\nform.mode.choose('delivery');\nform.address.type('Długa 5');\nform.slots.pick('18:30');\nconsole.log(form.submit.enabled); // true\nform.mode.choose('pickup');\nconsole.log(form.submit.enabled); // false – pick a pickup slot first"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"OrderForm.java"},"content":[{"type":"text","text":"import java.util.List;\n\ninterface FormMediator {\n    void notify(Component sender);\n}\n\n// Components only know the mediator, never each other.\nabstract class Component {\n    private final FormMediator mediator;\n    Component(FormMediator mediator) { this.mediator = mediator; }\n    protected void changed() { mediator.notify(this); }\n}\n\nclass DeliveryMode extends Component {\n    String value = \"pickup\";\n    DeliveryMode(FormMediator m) { super(m); }\n    void choose(String value) { this.value = value; changed(); }\n}\n\nclass AddressField extends Component {\n    boolean visible;\n    String text = \"\";\n    AddressField(FormMediator m) { super(m); }\n    void type(String text) { this.text = text; changed(); }\n}\n\nclass SlotPicker extends Component {\n    List<String> options = List.of();\n    String selected;\n    SlotPicker(FormMediator m) { super(m); }\n    void pick(String slot) { selected = options.contains(slot) ? slot : null; changed(); }\n}\n\nclass SubmitButton extends Component {\n    boolean enabled;\n    SubmitButton(FormMediator m) { super(m); }\n}\n\n// The mediator is the only place that knows how components affect each other.\npublic class OrderForm implements FormMediator {\n    final DeliveryMode mode = new DeliveryMode(this);\n    final AddressField address = new AddressField(this);\n    final SlotPicker slots = new SlotPicker(this);\n    final SubmitButton submit = new SubmitButton(this);\n\n    OrderForm() { notify(mode); }\n\n    @Override public void notify(Component sender) {\n        if (sender == mode) {\n            address.visible = mode.value.equals(\"delivery\");\n            slots.options = address.visible ? List.of(\"18:30\", \"19:00\") : List.of(\"17:45\", \"18:00\", \"18:15\");\n            slots.selected = null;\n        }\n        submit.enabled = slots.selected != null && (!address.visible || !address.text.isEmpty());\n    }\n\n    public static void main(String[] args) {\n        var form = new OrderForm();\n        form.mode.choose(\"delivery\");\n        form.address.type(\"Długa 5\");\n        form.slots.pick(\"18:30\");\n        System.out.println(form.submit.enabled); // true\n        form.mode.choose(\"pickup\");\n        System.out.println(form.submit.enabled); // false\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"order_form.go"},"content":[{"type":"text","text":"package main\n\nimport (\n\t\"fmt\"\n\t\"slices\"\n)\n\n// Mediator is the only thing components know about.\ntype Mediator interface{ Changed(sender any) }\n\ntype DeliveryMode struct {\n\tm     Mediator\n\tValue string\n}\n\nfunc (d *DeliveryMode) Choose(v string) {\n\td.Value = v\n\td.m.Changed(d)\n}\n\ntype AddressField struct {\n\tm       Mediator\n\tVisible bool\n\tText    string\n}\n\nfunc (a *AddressField) Type(t string) {\n\ta.Text = t\n\ta.m.Changed(a)\n}\n\ntype SlotPicker struct {\n\tm        Mediator\n\tOptions  []string\n\tSelected string\n}\n\nfunc (s *SlotPicker) Pick(slot string) {\n\ts.Selected = \"\"\n\tif slices.Contains(s.Options, slot) {\n\t\ts.Selected = slot\n\t}\n\ts.m.Changed(s)\n}\n\n// OrderForm coordinates the components; the submit button is just a flag here.\ntype OrderForm struct {\n\tMode          DeliveryMode\n\tAddress       AddressField\n\tSlots         SlotPicker\n\tSubmitEnabled bool\n}\n\nfunc NewOrderForm() *OrderForm {\n\tf := &OrderForm{}\n\tf.Mode, f.Address, f.Slots = DeliveryMode{m: f, Value: \"pickup\"}, AddressField{m: f}, SlotPicker{m: f}\n\tf.Changed(&f.Mode)\n\treturn f\n}\n\nfunc (f *OrderForm) Changed(sender any) {\n\tif sender == &f.Mode {\n\t\tf.Address.Visible = f.Mode.Value == \"delivery\"\n\t\tf.Slots.Options = []string{\"17:45\", \"18:00\", \"18:15\"}\n\t\tif f.Address.Visible {\n\t\t\tf.Slots.Options = []string{\"18:30\", \"19:00\"}\n\t\t}\n\t\tf.Slots.Selected = \"\"\n\t}\n\tf.SubmitEnabled = f.Slots.Selected != \"\" && (!f.Address.Visible || f.Address.Text != \"\")\n}\n\nfunc main() {\n\tf := NewOrderForm()\n\tf.Mode.Choose(\"delivery\")\n\tf.Address.Type(\"Długa 5\")\n\tf.Slots.Pick(\"18:30\")\n\tfmt.Println(f.SubmitEnabled) // true\n\tf.Mode.Choose(\"pickup\")\n\tfmt.Println(f.SubmitEnabled) // false\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"order_form.py"},"content":[{"type":"text","text":"from __future__ import annotations\n\n\nclass Component:\n    \"\"\"Components only know the mediator, never each other.\"\"\"\n\n    def __init__(self, mediator: OrderForm) -> None:\n        self._mediator = mediator\n\n    def _changed(self) -> None:\n        self._mediator.notify(self)\n\n\nclass DeliveryMode(Component):\n    value = \"pickup\"\n\n    def choose(self, value: str) -> None:\n        self.value = value\n        self._changed()\n\n\nclass AddressField(Component):\n    visible = False\n    text = \"\"\n\n    def type(self, text: str) -> None:\n        self.text = text\n        self._changed()\n\n\nclass SlotPicker(Component):\n    options: list[str] = []\n    selected: str | None = None\n\n    def pick(self, slot: str) -> None:\n        self.selected = slot if slot in self.options else None\n        self._changed()\n\n\nclass OrderForm:\n    \"\"\"The mediator: the only place that knows how components affect each other.\"\"\"\n\n    def __init__(self) -> None:\n        self.mode = DeliveryMode(self)\n        self.address = AddressField(self)\n        self.slots = SlotPicker(self)\n        self.submit_enabled = False\n        self.notify(self.mode)\n\n    def notify(self, sender: Component) -> None:\n        if sender is self.mode:\n            self.address.visible = self.mode.value == \"delivery\"\n            self.slots.options = [\"18:30\", \"19:00\"] if self.address.visible else [\"17:45\", \"18:00\", \"18:15\"]\n            self.slots.selected = None\n        self.submit_enabled = self.slots.selected is not None and (\n            not self.address.visible or self.address.text != \"\"\n        )\n\n\nform = OrderForm()\nform.mode.choose(\"delivery\")\nform.address.type(\"Długa 5\")\nform.slots.pick(\"18:30\")\nprint(form.submit_enabled)  # True\nform.mode.choose(\"pickup\")\nprint(form.submit_enabled)  # False"}]}]}]},"toc":[{"id":"the-problem-a-mesh-of-dependencies","text":"The problem: a mesh of dependencies","level":2,"locked":false},{"id":"the-solution-a-single-coordinator","text":"The solution: a single coordinator","level":2,"locked":false},{"id":"implementation-in-five-languages","text":"Implementation in five languages","level":2,"locked":false},{"id":"step-by-step","text":"Step by step","level":2,"locked":true},{"id":"mediator-vs-mediatr","text":"Mediator vs MediatR","level":2,"locked":true},{"id":"when-to-use-it-and-when-not-to","text":"When to use it and when not to","level":2,"locked":true},{"id":"related-patterns","text":"Related patterns","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"test-yourself","text":"Test yourself","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":35,"visibleBlocks":15,"resources":[{"id":"6b0857bf3c96f2d34d0b42cc","type":"article","provider":"web","url":"https://refactoring.guru/pl/design-patterns/mediator","embedUrl":null,"title":"Mediator / Mediator","description":"Mediator to behawioralny wzorzec projektowy pozwalający zredukować chaos zależności pomiędzy obiektami. Wzorzec ten ogranicza bezpośrednią komunikację pomiędzy obiektami i zmusza je do współpracy wyłącznie za pośrednictwem obiektu mediatora","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/pl/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"pl","topics":["mediator"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":60,"verifiedAt":"2026-11-26T11:26:12.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857c63c96f2d34d0b48c7","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=2xiHO1tv4Cc","embedUrl":"https://www.youtube-nocookie.com/embed/2xiHO1tv4Cc","title":"No, You Really Don't Need MediatR in .NET","description":"Online Workshop: Vibe Coding for Production: https://dometrain.com/workshop/vibe-coding-for-production/?ref=nick-chapsas&promo=mail-list&coupon_code=3YEARS Get every Dometrain 40% off with code 3YEARS: https://dometrain.com/courses/?ref=nick-chapsas&promo=youtube&coupon_code=3YEARS Hello…","author":"Nick Chapsas","thumbnailUrl":"https://i.ytimg.com/vi/2xiHO1tv4Cc/hqdefault.jpg","durationSec":null,"lang":"en","topics":["ai-coding-assistants","ai-in-dotnet"],"techs":["dotnet"],"tags":["ai"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"youtube-rss","publishedAt":"2026-05-20T12:30:34.000Z","popularity":69,"verifiedAt":"2026-11-26T10:54:20.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:10.095Z","updatedAt":"2026-11-26T16:01:10.095Z"},{"id":"6b0857c03c96f2d34d0b43e9","type":"article","provider":"web","url":"https://milanjovanovic.tech/blog/stop-conflating-cqrs-and-mediatr","embedUrl":null,"title":"CQRS vs MediatR: Do You Need MediatR?","description":"The .NET ecosystem has fused CQRS and MediatR together, and that shortcut leads teams into unnecessary complexity. They solve different problems.","author":"Milan Jovanović","thumbnailUrl":"https://milanjovanovic.tech/blog-covers/mnw_128.png","durationSec":null,"lang":"en","topics":["cqrs"],"techs":["dotnet"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2025-02-08T00:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:29:03.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857b23c96f2d34d0b3484","type":"repo","provider":"github","url":"https://github.com/LuckyPennySoftware/MediatR","embedUrl":null,"title":"LuckyPennySoftware/MediatR","description":"Simple, unambitious mediator implementation in .NET","author":"LuckyPennySoftware","thumbnailUrl":"https://opengraph.githubassets.com/1/LuckyPennySoftware/MediatR","durationSec":null,"lang":"en","topics":["mediator","cqrs"],"techs":["dotnet"],"tags":["hacktoberfest","design-patterns","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2014-03-03T15:01:22.000Z","popularity":79,"verifiedAt":"2026-11-26T10:55:56.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:49.541Z","updatedAt":"2026-11-26T16:00:49.541Z"}],"challenges":[{"id":"6b093dc191bd8fbaf2a0c8d0","slug":"inventory-cqrs","title":"Inventory with CQRS – separate write and read models","summary":"Warehouse commands validated on their own write model, events on a bus and a projection building a read model with a low-stock report. The read model can be rebuilt from events alone.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"medium","topics":["cqrs","event-driven-architecture"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["cqrs","read-model","projection","events","inventory"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":20,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:25.519Z"},{"id":"6b093dc091bd8fbaf2a0c8c0","slug":"event-sourced-account","title":"Event-sourced bank account","summary":"An account aggregate whose state comes only from replaying events, an event store with optimistic concurrency and a repository that saves only new facts. Queries about past state come for free.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"hard","topics":["event-sourcing","cqrs"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["event-sourcing","aggregate","event-store","optimistic-concurrency","ddd"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":40,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:24.935Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"gof-behavioral","title":"GoF behavioral patterns","items":[{"slug":"strategy","title":"Strategy: interchangeable algorithms instead of an if-else ladder","current":false},{"slug":"observer","title":"Observer: notify everyone without knowing anyone","current":false},{"slug":"command","title":"Command: a request wrapped in an object","current":false},{"slug":"state","title":"State: an object that changes behaviour with its life stage","current":false},{"slug":"template-method","title":"Template Method: a fixed recipe, interchangeable ingredients","current":false},{"slug":"iterator","title":"Iterator: walking a collection without looking inside","current":false},{"slug":"chain-of-responsibility","title":"Chain of Responsibility: pass it on until someone takes care of it","current":false},{"slug":"mediator","title":"Mediator: components talk through a coordinator","current":true},{"slug":"memento","title":"Memento: a state snapshot without breaking encapsulation","current":false},{"slug":"visitor","title":"Visitor: new operations without changing classes","current":false}]}],"prev":{"slug":"chain-of-responsibility","title":"Chain of Responsibility: pass it on until someone takes care of it"},"next":{"slug":"memento","title":"Memento: a state snapshot without breaking encapsulation"},"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}