One controller writes multiple methods and one controller writes one method.

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.