Command
Allows you to encapsulate actions in objects. The key idea behind this pattern is to provide the means to decouple client from receiver.
Real world example
A generic example would be you ordering food at a restaurant. You (i.e. Client
) ask the waiter (i.e. Invoker
) to bring some food (i.e. Command
) and waiter simply forwards the request to Chef (i.e. Receiver
) who has the knowledge of what and how to cook. Another example would be you (i.e. Client
) switching on (i.e. Command
) the television (i.e. Receiver
) using a remote control (Invoker
).