Skip to content

Instantly share code, notes, and snippets.

@nitindhar7
Created September 25, 2011 22:04
Show Gist options
  • Save nitindhar7/1241228 to your computer and use it in GitHub Desktop.
Save nitindhar7/1241228 to your computer and use it in GitHub Desktop.
Command Pattern: Restaurant Example
// Client
class Customer {
// places an order (requesting a command)
}
// Command
class Order {
// waiter places this
}
// Command
class Refund {
// manager fulfills this
}
// Invoker
class Waiter {
// writes the order on a notepad (queuing the order)
}
// Receiver
class Chef {
// cooks the orders in the queue
}
// Receiver
class Manager {
// Fulfills the customers request
}
@deepaksingh2801
Copy link

It will be nice to have an main class that piece them all together to provide a sample working example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment