Skip to content

Command Pattern

Brooks Johnson edited this page Oct 6, 2021 · 1 revision

Four terms to remember with the command pattern

  1. invoker, client, command and receiver

A command object can call a particular method in the receiver An invoker only knows about its command interface -Remains unaware of concrete commands

The client holds the invoker and the command objects -creates a command object and sets its receiver

Invoker -asks the command to carry out the request by calling its execute method

Receiver -Knows how to perform the work to carry out the request -Any class my server as a receiver

Clone this wiki locally