
Command Pattern : Design Patterns In Python
Channel Membership : https://www.youtube.com/channel/UCmUILI2AWt2MSUgPlZwFdOg/join
Documentation : https://sbcode.net/python/command/
The Command pattern is a behavioral design pattern, in which an abstraction exists between an object that invokes a command, and the object that performs it.
E.g., a button will call the Invoker, that will call a pre-registered Command, that the Receiver will perform.
A Concrete Class will delegate a request to a command object, instead of implementing the request directly.
The command pattern is a good solution for implementing UNDO/REDO functionality into your application.
Uses:
GUI Buttons, menus
Macro recording
Multi-level undo/redo
Networking - send whole command objects across a network, even as a batch
Parallel processing or thread pools
Transactional behavior
Wizards
(Book) Sometimes you just want to switch off your computer and read from a book. So, all GoF patterns are discussed in my Design Patterns In Python book
https://www.amazon.com/dp/B08XLJ8Z2J : ASIN B08XLJ8Z2J
https://www.amazon.com/dp/B08Z282SBC : ASIN B08Z282SBC
#command
#commandPattern
#designPatterns
#pythonDesignPatterns