Controller needs to be a class?

3

The controllers within an MVC need to be classes? Because of what I'm seeing here, their only function is to get the information that the view is asking for, to play the model and to solve the problem, and when it's solved, it takes the solution ready and sends it back again ... Is it really necessary to be a class?

    
asked by anonymous 19.12.2017 / 21:01

1 answer

3

As far as I know, technically it does not have to be, but the way everyone implements it is through a class.

If you do otherwise it may even be better, you may be innovating in a way, going against the tide in a positive way. But you can do it all wrong by not having experience with it and by having nothing that you've been testing and validated by others to "copy". It can be a shot in the dark ... and it can compensate:)

But if you use class for everything else and not controller , then I find it strange.

Your understanding of the pattern is correct, implementing it correctly is more important.

If you innovate in controller you may not need MVC. In fact there is a current already questioning its use, and I am not talking about one or the other outsider like me, in fact there are already more suitable forms for many scenarios.

    
19.12.2017 / 21:09