MVC Restaurant

I had a tough time understanding MVC in college when I first heard about it. Here is a good analogy that I found useful to understand it.

Compare MVC to a restaurant. View acts as a customer, Controller as a waiter, and the Model as a cook. In a restaurant, a customer never has to deal with the cook. The waiter, acting as a middleman, takes orders from the customer and lets the cook know. When the food is ready, cook doesn’t serve the customer, he gives it to the waiter and waiter gives it to customer.

A View(customer) never deals with the Model(cook). It asks the controller(waiter) to get whatever data it needs. Then the controller retrieves the data from the model and passes it to the View.