One controller writes multiple methods and one controller writes one method. one controller is a class in the framework, there is no relationship between the methods (for example, A method in the controller class is used to display the page, and another B method is used to display the B page ).
In this case, I have several confusions:
1. in the object-oriented thinking, there is no link between multiple methods in a class. this is not suitable.
2. is this object too large when it is instantiated as an object?
In this case, only one method is written in a controller class (for example, if you query data from a database and display the page, you can create a controller with only one method in it. In reality, another B controller is built on the B page, and there is only one method in it). is this more suitable than the existing mvc framework (writing multiple methods in one controller?
Reply to discussion (solution)
The example you gave is really bad!
It is clear that different templates (views) are called, and the business logic is identical.
Just like eating, drinking, pulling, dropping, and sleeping, it's like a method in the human class.
The example you gave is really bad!
It is clear that different templates (views) are called, and the business logic is identical.
It seems yes ...... Rotten
Communication and learning