Grokking Design Patterns for Engineers and Managers
Vote

0% completed

Command Pattern

The Command Pattern turns a request into an object, so it can be kept, queued, logged, retried, or undone.

A method call happens once, right now, and leaves no trace. That is usually fine. It stops being fine when you need any of these:

  • Undo. The user wants the last two changes reversed.
  • A queue. The work should run later, on a worker, rather than in the request thread.
  • A log of intent. An auditor wants to know what was asked for, not only what the data looks like now.
  • Retry. A failed action needs to be attempted again with the original arguments.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content