T
T
thirteen_bit2019-03-03 18:53:40
Design patterns
thirteen_bit, 2019-03-03 18:53:40

How to describe cooking scrambled eggs in terms of MVC?

I'm trying to understand the concept of MVC, specifically - the separation of business logic and presentation. Business process - cooking scrambled eggs. The level of abstraction can be any, most importantly, adequate)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
U
Urukhayy, 2019-03-04
@Urukhayy

Over time, there have been many interpretations.
One example of MVC is - game console .
View prefix itself - a TV that connects to the prefix
Controller - the controller for the game console (manipulator), that's what it is called. Unofficially - "joystick".
The key point is the Model (the prefix itself ), all complex processes and calculations, data storage and miscalculations take place in it.
View, which, in accordance with TV , is only a means of presenting information from a view convenient for a prefix (zeros and ones), into a view convenient for a person.
Controller, which is in line with the game controller, is a way of converting commands from a human-friendly view (forward, jump) to a prefix-friendly view.
The model, in principle, implies that it itself has the presence of functions that allow it to change. The controller only commands - at what point in time which functions need to be called in order to change the model. If you remove the game controller from the system and try to close the contacts in the socket of the game console with a screwdriver (i.e., go directly to the model, bypassing the controller), thereby trying to "control the character", then it will be difficult - it is much easier to press the button, and the controller transforms this into the desired form.
Picture from wiki :
MVC-Process.png

E
Evgeny Samsonov, 2019-03-03
@bitniks

To put it simply, cooking scrambled eggs in a cafe
The waiter is the Controller The
cook is the Model The
scrambled eggs on the table is the View
The visitor ordered the scrambled eggs through the waiter (C). The waiter passed the order to the cook (M). The chef cooked and the waiter put the plate on the table (V) to the visitor
Of course, in the original MVC, the table itself should somehow display what the chef has prepared, without the participation of the waiter :)

N
Northern Lights, 2019-03-03
@php666

MVC on the example of a car

Business process - cooking scrambled eggs.
Bad example. Cooking scrambled eggs is a business process divided into many other processes. The business process as such is part of the model.

K
Kirill Mokevnin, 2019-03-04
@toxicmt

You were right about business processes. I will add that there are two MVCs, one for thick clients (frontend), the other for client-server architecture, what is within http. They are very different and each of these versions relies on the features of the environment in which it is used: in the clients, the event model, in the backend, the client-server model.
But here and there M is your subject area, something that does not depend on where and how it is used. The process of ordering scrambled eggs is a business process that will be absolutely identical, from an algorithmic point of view, wherever you implement it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question