The command pattern is used to implement loose-coupling in a request-response model. In this pattern, the request is sent to the invoker and the invoker passes it to the encapsulated command object. The command object passes the request to the appropriate method of receiver to perform the specific action.
1. One example of the command pattern being executed
in the real world is the idea of a table order at a restaurant: the waiter
takes the order, which is a command from the customer. This order is then queued
for the kitchen staff. The waiter tells the chef that a new order has
come in, and the chef has enough information to cook the meal.
No comments:
Post a Comment