Created
September 25, 2011 22:04
-
-
Save nitindhar7/1241228 to your computer and use it in GitHub Desktop.
Command Pattern: Restaurant Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will be nice to have an main class that piece them all together to provide a sample working example