I
I
ixon2019-08-07 11:15:40
Design patterns
ixon, 2019-08-07 11:15:40

Which approach in MVC design is more efficient and what are they called correctly?

Suppose we should implement authorization and registration of users on the site. Then we can create a users controller and use it as a tool to call several models: for user registration, for authorization, for displaying a list of users and the corresponding views for each case.
Or we can make users_registration, users_authorithation, users_list controllers to register, authorize and list users. And similar models and types for each of them.
Which of these approaches is more effective, what are these approaches called, if they have names?
If I'm wrong about something, please also write about it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Derepko, 2019-08-07
@uDenX

One controller with a couple of methods is enough for this.
You don’t need to pile up controllers, but you also don’t need to bring it to the point of absurdity.
The method in the controller must call the model and pass the result to the view, so there will not be much code. There
are other approaches besides MVC -Tyk

N
Northern Lights, 2019-08-07
@php666

Or we can make users_registration, users_authorithation, users_list controllers to register, authorize and list users.
When I wrote my framework at the dawn of my web programming, I went down this path. This is very convenient, I tell you - the controllers are relatively small, not overloaded with code, each has only one run () method. Here is an example of a user deletion controller that is called from the admin. There is only one controller for this action. All. No extra code that could be if I used one common UserController.
The fact is that in real life it is quite difficult to get rid of TTUK , here is an example of a registration controller that should both call methods for saving the model and do implicit authorization + send a letter + some other actions. He's bigger now.
That's why I'm in favor of this approach.

L
Leonid, 2019-08-07
@caballero

cfvsq effective approach how not to use MVC which on the web is like a saddle on a cow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question