Command
medium 50 minA command wraps a request in an object: what to do, with which receiver and parameters.
Watch lesson4:52
Where it shows up
The same pattern appears across everyday software.
Qt undo framework
Qt calls its undo framework an implementation of the Command pattern. QUndoStack merges commands with mergeWith, has an undo limit, macros, and a clean state for the saved document.
Swing Action
The Action interface is useful when the same functionality is reached from several controls: menu, toolbar and key share one object, with its text and its enabled state.
Swing UndoManager
Keeps a list of UndoableEdits with a limit on how many it holds, and undoes or redoes them.
VS Code commands
Extensions bind a command id to a handler with registerCommand. Users and other extensions run it by id with executeCommand.
WPF commanding
The documentation names four concepts: command, command source (the invoker), command target and command binding. CanExecute decides whether a button is enabled.
Java ExecutorService
submit takes a Runnable task and returns a Future. The task is a command without undo, and the executor is an invoker with a queue and threads.
Celery
Tasks are sent as messages. The guide says that task functions should ideally be idempotent, and that acks_late acknowledges after the task has returned.
Sidekiq
Jobs are a class name and simple arguments. Its best practices ask for idempotent and transactional jobs, because a job may be retried half processed.
Redux actions
Changes are described by plain objects. The documentation says that they can be logged, serialised, stored and replayed for debugging or testing.
Redis append only file
Logs every write operation the server receives and replays them at start to rebuild the data.