{"id":"6b08bd3080884893657cc8fc","slug":"chain-of-responsibility","title":"Łańcuch zobowiązań (Chain of Responsibility): podaj dalej, aż ktoś się zajmie","summary":"Wzorzec Łańcuch zobowiązań na przykładzie reklamacji w pierogarni: bot, kierownik zmiany i właścicielka tworzą łańcuch, a reklamacja wędruje, aż trafi do kogoś uprawnionego. Wariant klasyczny i potok middleware, kod w pięciu językach.","servedLang":"pl","availableLangs":["pl","en"],"topics":["chain-of-responsibility"],"techs":["dotnet","typescript","java","go","python"],"tags":["gof","behavioral","chain-of-responsibility","middleware","pipeline"],"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":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:13:52.282Z","updatedAt":"2026-11-27T10:05:02.998Z","requestedLang":"pl","theme":{"hero":"classic","heroMedia":null,"accent":"violet","background":"dots","weaveResources":true,"toc":"right"},"seoDescription":"Wzorzec Łańcuch zobowiązań (Chain of Responsibility) w C#, TypeScript, Java, Go i Python: obsługujący, przekazywanie żądania i middleware w ASP.NET Core.","wordCount":2207,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Klient pisze, że pierogi dojechały zimne. Jeśli chodzi o 15 zł i jest zdjęcie, zwrot może zrobić automat. Przy większej kwocie decyduje kierownik zmiany, a przy naprawdę dużej – sama Halina. "},{"type":"text","text":"Łańcuch zobowiązań","marks":[{"type":"bold"}]},{"type":"text","text":" (ang. "},{"type":"text","text":"Chain of Responsibility","marks":[{"type":"italic"}]},{"type":"text","text":") układa takich obsługujących w kolejkę: żądanie wędruje od jednego do drugiego, aż ktoś je przejmie."}]},{"type":"callout","attrs":{"variant":"tip","title":"W skrócie"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Obsługujący ("},{"type":"text","text":"handlers","marks":[{"type":"italic"}]},{"type":"text","text":") tworzą "},{"type":"text","text":"łańcuch","marks":[{"type":"bold"}]},{"type":"text","text":"; każdy zna tylko następnego."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Każde ogniwo "},{"type":"text","text":"samo decyduje","marks":[{"type":"bold"}]},{"type":"text","text":": obsłużyć żądanie albo przekazać je dalej."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Nadawca nie wie, kto ostatecznie obsłuży żądanie – zna tylko początek łańcucha."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"3","label":"ogniwa łańcucha","hint":"bot, kierownik zmiany, właścicielka"},{"value":"20 zł","label":"limit automatycznego zwrotu","hint":"ze zdjęciem"},{"value":"1","label":"punkt wejścia dla nadawcy","hint":"pierwsze ogniwo"}]}},{"type":"heading","attrs":{"level":2,"id":"problem-jedna-funkcja-zna-cala-hierarchie"},"content":[{"type":"text","text":"Problem: jedna funkcja zna całą hierarchię"}]},{"type":"paragraph","content":[{"type":"text","text":"Obsługa reklamacji zaczęła się od zwykłego "},{"type":"text","text":"if","marks":[{"type":"code"}]},{"type":"text","text":"/"},{"type":"text","text":"elif","marks":[{"type":"code"}]},{"type":"text","text":":"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"complaints_before.py"},"content":[{"type":"text","text":"def handle_complaint(c: Complaint) -> str:\n    if c.amount <= 20 and c.has_photo:\n        return refund_automatically(c)\n    elif c.amount <= 100 and is_shift_manager_on_duty():\n        return ask_shift_manager(c)\n    elif c.amount <= 100:\n        return ask_owner(c)  # copy of the branch below, \"temporarily\"\n    else:\n        return ask_owner(c)\n    # next request: \"add an AI triage step before the bot, but only on weekends\""}]},{"type":"paragraph","content":[{"type":"text","text":"Funkcja zna wszystkich uczestników procesu, ich limity i kolejność. Każda zmiana – nowy krok weryfikacji, inny próg, triaż przez model AI w weekendy – wymaga edycji tej samej funkcji. Nie da się też złożyć innego łańcucha dla innego kanału (np. reklamacje z aplikacji dostawczej omijają bota), bez kopiowania całości."}]},{"type":"heading","attrs":{"level":2,"id":"rozwiazanie-obslugujacy-polaczeni-w-lancuch"},"content":[{"type":"text","text":"Rozwiązanie: obsługujący połączeni w łańcuch"}]},{"type":"paragraph","content":[{"type":"text","text":"Każdy uczestnik procesu staje się obiektem z metodą "},{"type":"text","text":"handle(complaint)","marks":[{"type":"code"}]},{"type":"text","text":" i referencją do "},{"type":"text","text":"następnego","marks":[{"type":"bold"}]},{"type":"text","text":" ogniwa. Ogniwo sprawdza, czy potrafi obsłużyć żądanie; jeśli tak – obsługuje i kończy, jeśli nie – przekazuje dalej. Kolejność i skład łańcucha ustala kod konfiguracyjny, a nie sami obsługujący."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  R([\"Reklamacja\"]) --> B{\"Bot: ≤ 20 zł i zdjęcie?\"}\n  B -- tak --> B1[\"Automatyczny zwrot\"]\n  B -- nie --> M{\"Kierownik: ≤ 100 zł?\"}\n  M -- tak --> M1[\"Akceptacja kierownika\"]\n  M -- nie --> O[\"Halina: telefon do klienta\"]","caption":"Łańcuch obsługi reklamacji"}},{"type":"diagram","attrs":{"kind":"mermaid","code":"sequenceDiagram\n  participant C as Klient\n  participant B as AutoRefund\n  participant M as ShiftManager\n  participant O as Owner\n  C->>B: handle(zam. 103, 340 zł)\n  Note over B: powyżej limitu – podaj dalej\n  B->>M: handle(...)\n  Note over M: powyżej limitu – podaj dalej\n  M->>O: handle(...)\n  O-->>M: Halina zadzwoni do klienta\n  M-->>B: wynik\n  B-->>C: wynik","caption":"Reklamacja na 340 zł przechodzi przez cały łańcuch"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Rola"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"W przykładzie"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Odpowiedzialność"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Obsługujący ("},{"type":"text","text":"Handler","marks":[{"type":"italic"}]},{"type":"text","text":")"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ComplaintHandler","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"wspólny interfejs i referencja do następnego ogniwa"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Konkretny obsługujący"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"AutoRefund","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"ShiftManager","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"Owner","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"decyduje: obsłużyć czy przekazać"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Klient"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"formularz reklamacji"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"wysyła żądanie do pierwszego ogniwa"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Konfiguracja"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"kod budujący łańcuch"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ustala skład i kolejność ogniw"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"implementacja-w-pieciu-jezykach"},"content":[{"type":"text","text":"Implementacja w pięciu językach"}]},{"type":"paragraph","content":[{"type":"text","text":"W C#, TypeScripcie, Javie i Pythonie klasa bazowa trzyma referencję do następnego ogniwa i realizuje logikę „obsłuż albo przekaż”, a podklasy dostarczają tylko warunek i sposób obsługi. Metoda "},{"type":"text","text":"setNext","marks":[{"type":"code"}]},{"type":"text","text":" zwraca następne ogniwo, dzięki czemu łańcuch buduje się płynnie. W Go ogniwo to struktura z dwiema funkcjami, a łańcuch składa funkcja "},{"type":"text","text":"Chain","marks":[{"type":"code"}]},{"type":"text","text":"."}]},{"type":"codeGroup","attrs":{"title":"Łańcuch zobowiązań – reklamacje"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Complaints.cs"},"content":[{"type":"text","text":"var chain = new AutoRefund();\nchain.SetNext(new ShiftManager()).SetNext(new Owner());\n\nConsole.WriteLine(chain.Handle(new Complaint(101, 15m, HasPhoto: true)));  // Bot: refunded 15 PLN\nConsole.WriteLine(chain.Handle(new Complaint(102, 15m, HasPhoto: false))); // Shift manager approved 15 PLN\nConsole.WriteLine(chain.Handle(new Complaint(103, 340m, HasPhoto: true))); // Halina will call the customer\n\npublic sealed record Complaint(int OrderId, decimal Amount, bool HasPhoto);\n\npublic abstract class ComplaintHandler\n{\n    private ComplaintHandler? _next;\n\n    // Returns the next handler, so the chain can be built fluently.\n    public ComplaintHandler SetNext(ComplaintHandler next) => _next = next;\n\n    public string Handle(Complaint c) =>\n        CanHandle(c) ? Resolve(c)\n        : _next?.Handle(c) ?? $\"#{c.OrderId}: nobody could handle the complaint\";\n\n    protected abstract bool CanHandle(Complaint c);\n    protected abstract string Resolve(Complaint c);\n}\n\npublic sealed class AutoRefund : ComplaintHandler\n{\n    protected override bool CanHandle(Complaint c) => c.Amount <= 20m && c.HasPhoto;\n    protected override string Resolve(Complaint c) => $\"#{c.OrderId}: Bot: refunded {c.Amount} PLN\";\n}\n\npublic sealed class ShiftManager : ComplaintHandler\n{\n    protected override bool CanHandle(Complaint c) => c.Amount <= 100m;\n    protected override string Resolve(Complaint c) => $\"#{c.OrderId}: Shift manager approved {c.Amount} PLN\";\n}\n\npublic sealed class Owner : ComplaintHandler\n{\n    protected override bool CanHandle(Complaint c) => true; // the last link takes everything\n    protected override string Resolve(Complaint c) => $\"#{c.OrderId}: Halina will call the customer\";\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"complaints.ts"},"content":[{"type":"text","text":"type Complaint = { orderId: number; amount: number; hasPhoto: boolean };\n\nabstract class ComplaintHandler {\n  private next?: ComplaintHandler;\n\n  /** Returns the next handler, so the chain can be built fluently. */\n  setNext(next: ComplaintHandler): ComplaintHandler {\n    this.next = next;\n    return next;\n  }\n\n  handle(c: Complaint): string {\n    if (this.canHandle(c)) return this.resolve(c);\n    return this.next?.handle(c) ?? `#${c.orderId}: nobody could handle the complaint`;\n  }\n\n  protected abstract canHandle(c: Complaint): boolean;\n  protected abstract resolve(c: Complaint): string;\n}\n\nclass AutoRefund extends ComplaintHandler {\n  protected canHandle(c: Complaint) { return c.amount <= 20 && c.hasPhoto; }\n  protected resolve(c: Complaint) { return `#${c.orderId}: Bot: refunded ${c.amount} PLN`; }\n}\n\nclass ShiftManager extends ComplaintHandler {\n  protected canHandle(c: Complaint) { return c.amount <= 100; }\n  protected resolve(c: Complaint) { return `#${c.orderId}: Shift manager approved ${c.amount} PLN`; }\n}\n\nclass Owner extends ComplaintHandler {\n  protected canHandle() { return true; } // the last link takes everything\n  protected resolve(c: Complaint) { return `#${c.orderId}: Halina will call the customer`; }\n}\n\nconst chain = new AutoRefund();\nchain.setNext(new ShiftManager()).setNext(new Owner());\n\nconsole.log(chain.handle({ orderId: 101, amount: 15, hasPhoto: true }));  // Bot: refunded 15 PLN\nconsole.log(chain.handle({ orderId: 102, amount: 15, hasPhoto: false })); // Shift manager approved 15 PLN\nconsole.log(chain.handle({ orderId: 103, amount: 340, hasPhoto: true })); // Halina will call the customer"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"Complaints.java"},"content":[{"type":"text","text":"record Complaint(int orderId, double amount, boolean hasPhoto) {}\n\nabstract class ComplaintHandler {\n    private ComplaintHandler next;\n\n    // Returns the next handler, so the chain can be built fluently.\n    ComplaintHandler setNext(ComplaintHandler next) {\n        this.next = next;\n        return next;\n    }\n\n    final String handle(Complaint c) {\n        if (canHandle(c)) return resolve(c);\n        return next != null ? next.handle(c) : \"#\" + c.orderId() + \": nobody could handle the complaint\";\n    }\n\n    protected abstract boolean canHandle(Complaint c);\n    protected abstract String resolve(Complaint c);\n}\n\nclass AutoRefund extends ComplaintHandler {\n    protected boolean canHandle(Complaint c) { return c.amount() <= 20 && c.hasPhoto(); }\n    protected String resolve(Complaint c) { return \"#%d: Bot: refunded %.0f PLN\".formatted(c.orderId(), c.amount()); }\n}\n\nclass ShiftManager extends ComplaintHandler {\n    protected boolean canHandle(Complaint c) { return c.amount() <= 100; }\n    protected String resolve(Complaint c) { return \"#%d: Shift manager approved %.0f PLN\".formatted(c.orderId(), c.amount()); }\n}\n\nclass Owner extends ComplaintHandler {\n    protected boolean canHandle(Complaint c) { return true; } // the last link takes everything\n    protected String resolve(Complaint c) { return \"#%d: Halina will call the customer\".formatted(c.orderId()); }\n}\n\npublic class Complaints {\n    public static void main(String[] args) {\n        var chain = new AutoRefund();\n        chain.setNext(new ShiftManager()).setNext(new Owner());\n\n        System.out.println(chain.handle(new Complaint(101, 15, true)));  // Bot: refunded 15 PLN\n        System.out.println(chain.handle(new Complaint(102, 15, false))); // Shift manager approved 15 PLN\n        System.out.println(chain.handle(new Complaint(103, 340, true))); // Halina will call the customer\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"complaints.go"},"content":[{"type":"text","text":"package main\n\nimport \"fmt\"\n\ntype Complaint struct {\n\tOrderID  int\n\tAmount   float64\n\tHasPhoto bool\n}\n\ntype Handler interface {\n\tHandle(c Complaint) string\n}\n\n// link is one handler in the chain: it resolves the complaint or passes it on.\ntype link struct {\n\tname    string\n\tcan     func(Complaint) bool\n\tresolve func(Complaint) string\n\tnext    Handler\n}\n\nfunc (l *link) Handle(c Complaint) string {\n\tif l.can(c) {\n\t\treturn fmt.Sprintf(\"#%d: %s: %s\", c.OrderID, l.name, l.resolve(c))\n\t}\n\tif l.next == nil {\n\t\treturn fmt.Sprintf(\"#%d: nobody could handle the complaint\", c.OrderID)\n\t}\n\treturn l.next.Handle(c)\n}\n\n// Chain links the handlers in order and returns the first one.\nfunc Chain(links ...*link) Handler {\n\tfor i := 0; i < len(links)-1; i++ {\n\t\tlinks[i].next = links[i+1]\n\t}\n\treturn links[0]\n}\n\nfunc main() {\n\tchain := Chain(\n\t\t&link{name: \"Bot\",\n\t\t\tcan:     func(c Complaint) bool { return c.Amount <= 20 && c.HasPhoto },\n\t\t\tresolve: func(c Complaint) string { return fmt.Sprintf(\"refunded %.0f PLN\", c.Amount) }},\n\t\t&link{name: \"Shift manager\",\n\t\t\tcan:     func(c Complaint) bool { return c.Amount <= 100 },\n\t\t\tresolve: func(c Complaint) string { return fmt.Sprintf(\"approved %.0f PLN\", c.Amount) }},\n\t\t&link{name: \"Owner\",\n\t\t\tcan:     func(Complaint) bool { return true }, // the last link takes everything\n\t\t\tresolve: func(Complaint) string { return \"Halina will call the customer\" }},\n\t)\n\tfmt.Println(chain.Handle(Complaint{101, 15, true}))\n\tfmt.Println(chain.Handle(Complaint{102, 15, false}))\n\tfmt.Println(chain.Handle(Complaint{103, 340, true}))\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"complaints.py"},"content":[{"type":"text","text":"from __future__ import annotations\n\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\n\n\n@dataclass(frozen=True)\nclass Complaint:\n    order_id: int\n    amount: float\n    has_photo: bool\n\n\nclass ComplaintHandler(ABC):\n    def __init__(self) -> None:\n        self._next: ComplaintHandler | None = None\n\n    def set_next(self, handler: ComplaintHandler) -> ComplaintHandler:\n        \"\"\"Returns the next handler, so the chain can be built fluently.\"\"\"\n        self._next = handler\n        return handler\n\n    def handle(self, c: Complaint) -> str:\n        if self.can_handle(c):\n            return self.resolve(c)\n        if self._next is None:\n            return f\"#{c.order_id}: nobody could handle the complaint\"\n        return self._next.handle(c)\n\n    @abstractmethod\n    def can_handle(self, c: Complaint) -> bool: ...\n\n    @abstractmethod\n    def resolve(self, c: Complaint) -> str: ...\n\n\nclass AutoRefund(ComplaintHandler):\n    def can_handle(self, c): return c.amount <= 20 and c.has_photo\n    def resolve(self, c): return f\"#{c.order_id}: Bot: refunded {c.amount:.0f} PLN\"\n\n\nclass ShiftManager(ComplaintHandler):\n    def can_handle(self, c): return c.amount <= 100\n    def resolve(self, c): return f\"#{c.order_id}: Shift manager approved {c.amount:.0f} PLN\"\n\n\nclass Owner(ComplaintHandler):\n    def can_handle(self, c): return True  # the last link takes everything\n    def resolve(self, c): return f\"#{c.order_id}: Halina will call the customer\"\n\n\nchain = AutoRefund()\nchain.set_next(ShiftManager()).set_next(Owner())\nfor complaint in (Complaint(101, 15, True), Complaint(102, 15, False), Complaint(103, 340, True)):\n    print(chain.handle(complaint))"}]}]}]},"toc":[{"id":"problem-jedna-funkcja-zna-cala-hierarchie","text":"Problem: jedna funkcja zna całą hierarchię","level":2,"locked":false},{"id":"rozwiazanie-obslugujacy-polaczeni-w-lancuch","text":"Rozwiązanie: obsługujący połączeni w łańcuch","level":2,"locked":false},{"id":"implementacja-w-pieciu-jezykach","text":"Implementacja w pięciu językach","level":2,"locked":false},{"id":"krok-po-kroku","text":"Krok po kroku","level":2,"locked":true},{"id":"rozne-lancuchy-z-tych-samych-ogniw","text":"Różne łańcuchy z tych samych ogniw","level":2,"locked":true},{"id":"wariant-potok-middleware","text":"Wariant: potok middleware","level":2,"locked":true},{"id":"kiedy-stosowac-a-kiedy-nie","text":"Kiedy stosować, a kiedy nie","level":2,"locked":true},{"id":"powiazania-z-innymi-wzorcami","text":"Powiązania z innymi wzorcami","level":2,"locked":true},{"id":"w-praktyce","text":"W praktyce","level":2,"locked":true},{"id":"sprawdz-sie","text":"Sprawdź się","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":39,"visibleBlocks":15,"resources":[{"id":"6b0857bf3c96f2d34d0b427b","type":"article","provider":"web","url":"https://refactoring.guru/pl/design-patterns/chain-of-responsibility","embedUrl":null,"title":"Łańcuch zobowiązań / Chain of Responsibility","description":"Łańcuch zobowiązań jest behawioralnym wzorcem projektowym, który pozwala przekazywać żądania wzdłuż łańcucha obiektów obsługujących. Otrzymawszy żądanie, każdy z obiektów obsługujących decyduje o przetworzeniu żądania lub przekazaniu go do kolejnego obiektu obsługującego w łańcuchu.","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/pl/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"pl","topics":["chain-of-responsibility"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"verifiedAt":"2026-11-26T11:26:11.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857c73c96f2d34d0b4969","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=msXtN15qXOE","embedUrl":"https://www.youtube-nocookie.com/embed/msXtN15qXOE","title":"Building a Request Pipeline for Separating Concerns with Pipes & Filters","description":"How do you separate concerns when processing a request? Typical concerns such as Logging, Validation, Exception Handling, Retries, and many more. One way is to build a request pipeline for separating concerns by using the Pipes and Filters pattern. You can also build a pipeline using the Russian…","author":"CodeOpinion","thumbnailUrl":"https://i.ytimg.com/vi/msXtN15qXOE/hqdefault.jpg","durationSec":null,"lang":"en","topics":["event-sourcing"],"techs":["dotnet"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"youtube-rss","publishedAt":"2021-08-18T14:00:17.000Z","popularity":63,"verifiedAt":"2026-11-26T10:53:51.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:10.095Z","updatedAt":"2026-11-26T16:01:10.095Z"},{"id":"6b0857bc3c96f2d34d0b4047","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/design-patterns-iterators-observers-and-chains-oh-my/id769189585?i=1000378375263","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id769189585?i=1000378375263","title":"Design Patterns – Iterators, Observers, and Chains, Oh My","description":"We’re back to the gang of four, continuing with another segment of design patterns. This time we’re talking about some of our favorite Behavioral Design Patterns: Observer, Chain of Responsibilities, Iterator patterns. Also, why the visitor pattern is weird and what it’s like to be raked over hot…","author":"Coding Blocks","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts113/v4/f0/b6/68/f0b6682f-e8bc-181c-95a9-0756ddf63d6e/mza_3128980961332034780.jpg/600x600bb.jpg","durationSec":3828,"lang":"en","topics":["iterator","visitor"],"techs":["general"],"tags":["podcast","design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2014-11-09T01:53:47.000Z","popularity":44,"verifiedAt":"2026-11-26T10:57:23.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857c33c96f2d34d0b4658","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL6030812W","embedUrl":null,"title":"Design Patterns: Elements of Reusable Object-Oriented Software","description":"","author":"Erich Gamma, John Vlissides, Richard Helm, Ralph Johnson","thumbnailUrl":"https://covers.openlibrary.org/b/id/6601119-L.jpg","durationSec":null,"lang":"en","topics":["factory-method","abstract-factory","builder","prototype","singleton","adapter","bridge","composite","decorator","facade","flyweight","proxy","chain-of-responsibility","command","iterator","mediator","memento","observer","state","strategy","template-method","visitor"],"techs":["general"],"tags":["book","design-patterns"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"1995-01-01T00:00:00.000Z","popularity":71,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"}],"challenges":[{"id":"6b093dc191bd8fbaf2a0c8c4","slug":"expense-approval-chain","title":"Łańcuch akceptacji wydatków","summary":"Wydatek przechodzi przez kolejne ogniwa – kontrolę paragonu, lidera zespołu, menedżera i dyrektora – aż ktoś go zatwierdzi lub odrzuci. Łańcuch zobowiązań z wymiennymi ogniwami.","servedLang":"pl","availableLangs":["pl","en"],"kind":"code","category":"pattern","status":"published","difficulty":"easy","topics":["chain-of-responsibility"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["chain-of-responsibility","approval-workflow","behavioral","middleware"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":10,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:25.083Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"gof-behavioral","title":"Wzorce behawioralne GoF","items":[{"slug":"strategy","title":"Strategia (Strategy): wymienne algorytmy zamiast drabinki if-ów","current":false},{"slug":"observer","title":"Obserwator (Observer): powiadom wszystkich, nie znając nikogo","current":false},{"slug":"command","title":"Polecenie (Command): żądanie zamknięte w obiekcie","current":false},{"slug":"state","title":"Stan (State): obiekt, który zmienia zachowanie razem z etapem życia","current":false},{"slug":"template-method","title":"Metoda szablonowa (Template Method): stały przepis, wymienne składniki","current":false},{"slug":"iterator","title":"Iterator: przechodzenie po kolekcji bez zaglądania do środka","current":false},{"slug":"chain-of-responsibility","title":"Łańcuch zobowiązań (Chain of Responsibility): podaj dalej, aż ktoś się zajmie","current":true},{"slug":"mediator","title":"Mediator: komponenty rozmawiają przez koordynatora","current":false},{"slug":"memento","title":"Pamiątka (Memento): migawka stanu bez łamania hermetyzacji","current":false},{"slug":"visitor","title":"Odwiedzający (Visitor): nowe operacje bez zmiany klas","current":false}]}],"prev":{"slug":"iterator","title":"Iterator: przechodzenie po kolekcji bez zaglądania do środka"},"next":{"slug":"mediator","title":"Mediator: komponenty rozmawiają przez koordynatora"},"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":"Autorytet","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Autorytet","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Autorytet","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Autorytet","articles":38}]}}