To understand MVC

By aj   Posted on December-22-2022   188


MVC stands for Model, View, and Controller. MVC separates an application into three components - Model, View, and Controller.
Let's move to understand MVC in real life exemple.
Let’s assume you go to a restaurant. You will not go to the kitchen and prepare food which you can surely do at your home. Instead, you go there and wait for the waiter to come on.
Now the waiter comes to you, and you order the food. The waiter doesn’t know who you are and what you want he just written down the detail of your food order.
Then, the waiter moves to the kitchen. In the kitchen, waiter does not prepare your food.
The cook prepares your food. The waiter is given your order to him along with your table number.
Cook then prepared food for you. He uses ingredients to cooks the food. Let’s assume that your order a vegetable sandwich. Then he needs bread, tomato, potato, capsicum, onion, bit, cheese, etc. which he sources from the refrigerator
Cook final hand over the food to the waiter. Now it is the job of the waiter to moves this food outside the kitchen.
Now waiter knows which food you have ordered and how they are served.
In this MVC architecture example,
View= You
Waiter= Controller
Cook= Model
Refrigerator= Data

To understand the MVC by real life exemple.

By aj    22-Dec-2022 Views  188

You may also read following recent articles