A
A
Anton R.2019-10-04 17:09:45
Design patterns
Anton R., 2019-10-04 17:09:45

Do I understand correctly that in MVC the main component is the Model?

After all, it is in the Models that all entities are displayed and the logic is laid, and the controller is essentially just a kind of "manipulator" that receives a command from the router, then pulls the model and passes the result to the view.
But in some engines, Controllers are the opposite - very "thick" and contain a lot of logic, for example in Opencart.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
developer007, 2019-10-04
@developer007

roughly speaking yes. all movement in the model.
thick controllers are shit (it's normal for mvp projects)
logic should be moved to services/components.
in fact services/components are a model.
for some reason, everyone thinks that the model is an ActiveRecord entity that can enter the database and contains logic

A
Alexander, 2019-10-04
@UPSA

No.
Everything is important here ... or it depends on the task.
Done wrong Model - you can stumble on the controller and / or in the View with problems. For example, you change one cell in View, and to write data in the controller, write a multi-page script, well ... or vice versa. )))
They didn't make the controller correctly ... it won't work at all. )))
They made Vue wrong - they overloaded the server with redundant data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question