{"slug":"command","group":"behavioral","title":"Polecenie","short":"Zamienia żądanie w obiekt, który można kolejkować, zapisywać i cofać.","icon":"terminal","aliases":[],"order":302,"status":"available","articleCount":1,"groupTitle":"Wzorce behawioralne","intro":"","servedLang":"pl","primaryArticle":{"id":"6b08bd3080884893657cc910","slug":"command","title":"Polecenie (Command): żądanie zamknięte w obiekcie","summary":"Wzorzec Polecenie na przykładzie terminala kelnerskiego w pierogarni: każda akcja na bonie to obiekt z metodami execute i undo, więc da się ją cofnąć, ponowić, zapisać w historii i wysłać do kolejki. Kod w pięciu językach.","servedLang":"pl","availableLangs":["pl","en"],"topics":["command","cqrs"],"techs":["dotnet","typescript","java","go","python"],"tags":["gof","behavioral","command","undo-redo","queue"],"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":11,"stats":{"views":1,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:13:52.954Z","updatedAt":"2026-11-27T10:04:46.685Z","challengeCount":1,"quizCount":0},"articles":[],"challenges":[{"id":"6b093dc291bd8fbaf2a0c8e8","slug":"text-editor-undo","title":"Cofnij i ponów w edytorze tekstu","summary":"Operacje edytora jako polecenia z execute() i undo(), historia z cofaniem i ponawianiem, makra cofane jednym krokiem i limit pamiętanych zmian.","servedLang":"pl","availableLangs":["pl","en"],"kind":"code","category":"pattern","status":"published","difficulty":"medium","topics":["command"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["command","undo-redo","macro","text-editor","behavioral"],"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:26.885Z"}],"resources":[{"id":"6b0857bf3c96f2d34d0b4269","type":"article","provider":"web","url":"https://gameprogrammingpatterns.com/command.html","embedUrl":null,"title":"Command · Design Patterns Revisited · Game Programming Patterns","description":"","author":"Robert Nystrom","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"verifiedAt":"2026-11-26T11:26:36.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T23:13:50.277Z"},{"id":"6b0857bf3c96f2d34d0b4286","type":"article","provider":"web","url":"https://refactoring.guru/pl/design-patterns/command","embedUrl":null,"title":"Polecenie / Command","description":"Polecenie jest behawioralnym wzorcem projektowym który zmienia żądanie w samodzielny obiekt zawierający wszystkie informacje o tym żądaniu. Taka transformacja pozwala na parametryzowanie metod przy użyciu różnych żądań. Oprócz tego umożliwia opóźnianie lub kolejkowanie wykonywania żądań oraz…","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/pl/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"pl","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"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":"6b0857a53c96f2d34d0b3220","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=9qA5kw8dcSU","embedUrl":"https://www.youtube-nocookie.com/embed/9qA5kw8dcSU","title":"Command Pattern – Design Patterns (ep 7)","description":"","author":"Christopher Okhravi","thumbnailUrl":"https://i.ytimg.com/vi/9qA5kw8dcSU/hqdefault.jpg","durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:37.889Z","updatedAt":"2026-11-26T16:00:37.889Z"},{"id":"6b0857bb3c96f2d34d0b3f54","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/command-repository-and-mediator-design-patterns/id769189585?i=1000378375285","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id769189585?i=1000378375285","title":"Command, Repository and Mediator Design Patterns","description":"In this episode we go back to the design pattern well that we’ve been away from for so long. We cover the Command, Repository and Mediator design patterns. It was hard for us to believe, but it’s been almost a year since our last design patterns episode!!! Come on in for fun, learning, and of […]","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":7684,"lang":"en","topics":["mediator"],"techs":["general"],"tags":["podcast","design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2016-06-03T03:52:46.000Z","popularity":49,"verifiedAt":"2026-11-26T10:57:23.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:57.868Z","updatedAt":"2026-11-26T16:00:57.868Z"},{"id":"6b0857c33c96f2d34d0b4685","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL19650342W","embedUrl":null,"title":"Game Programming Patterns","description":"","author":"Robert Nystrom","thumbnailUrl":"https://covers.openlibrary.org/b/id/8566115-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"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2011-01-01T00:00:00.000Z","popularity":54,"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"},{"id":"6b0857be3c96f2d34d0b422f","type":"article","provider":"web","url":"https://refactoring.guru/design-patterns/command","embedUrl":null,"title":"Command","description":"Command is a behavioral design pattern that turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request's execution, and support undoable operations.","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:26:04.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857be3c96f2d34d0b423a","type":"article","provider":"web","url":"https://microservices.io/patterns/data/cqrs.html","embedUrl":null,"title":"Microservices Pattern: Pattern: Command Query Responsibility Segregation (CQRS)","description":"Define a queryable replica that is kept up to date by subscribing to events published by the services that own the data.","author":"Chris Richardson (microservices.io)","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["cqrs","microservices"],"techs":["general"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:25:54.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"}],"resourceGroups":[{"type":"video","items":[{"id":"6b0857a53c96f2d34d0b3220","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=9qA5kw8dcSU","embedUrl":"https://www.youtube-nocookie.com/embed/9qA5kw8dcSU","title":"Command Pattern – Design Patterns (ep 7)","description":"","author":"Christopher Okhravi","thumbnailUrl":"https://i.ytimg.com/vi/9qA5kw8dcSU/hqdefault.jpg","durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:37.889Z","updatedAt":"2026-11-26T16:00:37.889Z"}]},{"type":"podcast","items":[{"id":"6b0857bb3c96f2d34d0b3f54","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/command-repository-and-mediator-design-patterns/id769189585?i=1000378375285","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id769189585?i=1000378375285","title":"Command, Repository and Mediator Design Patterns","description":"In this episode we go back to the design pattern well that we’ve been away from for so long. We cover the Command, Repository and Mediator design patterns. It was hard for us to believe, but it’s been almost a year since our last design patterns episode!!! Come on in for fun, learning, and of […]","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":7684,"lang":"en","topics":["mediator"],"techs":["general"],"tags":["podcast","design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2016-06-03T03:52:46.000Z","popularity":49,"verifiedAt":"2026-11-26T10:57:23.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:57.868Z","updatedAt":"2026-11-26T16:00:57.868Z"}]},{"type":"article","items":[{"id":"6b0857bf3c96f2d34d0b4269","type":"article","provider":"web","url":"https://gameprogrammingpatterns.com/command.html","embedUrl":null,"title":"Command · Design Patterns Revisited · Game Programming Patterns","description":"","author":"Robert Nystrom","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"verifiedAt":"2026-11-26T11:26:36.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T23:13:50.277Z"},{"id":"6b0857bf3c96f2d34d0b4286","type":"article","provider":"web","url":"https://refactoring.guru/pl/design-patterns/command","embedUrl":null,"title":"Polecenie / Command","description":"Polecenie jest behawioralnym wzorcem projektowym który zmienia żądanie w samodzielny obiekt zawierający wszystkie informacje o tym żądaniu. Taka transformacja pozwala na parametryzowanie metod przy użyciu różnych żądań. Oprócz tego umożliwia opóźnianie lub kolejkowanie wykonywania żądań oraz…","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/pl/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"pl","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"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":"6b0857be3c96f2d34d0b422f","type":"article","provider":"web","url":"https://refactoring.guru/design-patterns/command","embedUrl":null,"title":"Command","description":"Command is a behavioral design pattern that turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request's execution, and support undoable operations.","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"en","topics":["command"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:26:04.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857be3c96f2d34d0b423a","type":"article","provider":"web","url":"https://microservices.io/patterns/data/cqrs.html","embedUrl":null,"title":"Microservices Pattern: Pattern: Command Query Responsibility Segregation (CQRS)","description":"Define a queryable replica that is kept up to date by subscribing to events published by the services that own the data.","author":"Chris Richardson (microservices.io)","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["cqrs","microservices"],"techs":["general"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:25:54.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"}]},{"type":"book","items":[{"id":"6b0857c33c96f2d34d0b4685","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL19650342W","embedUrl":null,"title":"Game Programming Patterns","description":"","author":"Robert Nystrom","thumbnailUrl":"https://covers.openlibrary.org/b/id/8566115-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"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2011-01-01T00:00:00.000Z","popularity":54,"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"}]}],"siblings":[{"slug":"chain-of-responsibility","title":"Łańcuch zobowiązań","icon":"link","status":"available","current":false},{"slug":"command","title":"Polecenie","icon":"terminal","status":"available","current":true},{"slug":"iterator","title":"Iterator","icon":"list-ordered","status":"available","current":false},{"slug":"mediator","title":"Mediator","icon":"messages-square","status":"available","current":false},{"slug":"memento","title":"Pamiątka","icon":"save","status":"available","current":false},{"slug":"observer","title":"Obserwator","icon":"eye","status":"available","current":false},{"slug":"state","title":"Stan","icon":"toggle-right","status":"available","current":false},{"slug":"strategy","title":"Strategia","icon":"route","status":"available","current":false},{"slug":"template-method","title":"Metoda szablonowa","icon":"layout-template","status":"available","current":false},{"slug":"visitor","title":"Odwiedzający","icon":"footprints","status":"available","current":false}]}