Wednesday, 1 February 2017

Object oriented design for a Restaurant

Let we start to design Object Oriented architecture of restaurant. Before start the design, we need to understand how a restaurant works.

Components required:
Customer
            Name
            Contact

selectDish(): Dish
Selects the dish from the menu.

callWaiter(): call upon a waiter.

placeOrder(d:Dish): Places the order and enjoy his meal once the dish is served on his table.

requestBill(): Ask for the bill to the waiter.

makePayment(): Pays for the services.

Waiter
            Name
            EmpId
            TableToWait
respondToCustomer(): Response to the customer’s calls on the tables he is waiting.

takeOrder(): Take the customer's order.

placeOrderToQueue(o:Order): Place the order in PendingOrderQueue.

handleOrderPreparedNotification(): Observer design pattern for notification
Wait for the order ready notifications.

serveDishToCustomer(d:Dish): Once notification is received, collects the dish and serves the dish to the corresponding customer.

takeBillRequest(): Receive the bill request from the customer.

acceptPayment(): Ask the Cashier to prepare the bill.

payMoneyToCashier(): Gives the bill to the customer and accepts the payment.

Chef
            EmpId

prepareDish(d:Dish): Get the next order from the PendingOrderQueue.

placeOrderInFinishedQueue(): Prepares the dish and push the order to finished order queue.

notifyOrderComplete(): Observer design pattern for notification
Send a notification that the order is ready.

Cashier
            Name
            EmpId

prepareBill(o:Order): Accepts the prepare bill request from the waiter for the given order details. Prepares the bills and hands it over to the waiter.

acceptPayment(): Accept the cash from the waiter towards the order.

Order (DTO)
            id
            Dish

Data structure used:
PendingOrderQueue
addOrder(o:Order): Waiter will place the order in the PendingOrderQueue.
getNextOrder(): Chef gets the next order from the PendingOrderQueue.

FinishedOrderQueue
getFinishedOrder(o:Order): Chef will prepare the dish and push the order to FinishedOrderQueue. 






4 comments:

  1. Awesome article. Thanks for sharing such a useful information

    ReplyDelete
  2. Thanks to share this great information.............................

    ReplyDelete
  3. The explaination of this project is amazing . can i get source code of this whole restaurant project .

    ReplyDelete
  4. please reply me . i really need this code .
    khadijarehman896@gmail.com
    reply me on my mail .

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...