PHP Project sentiment--from the CI framework to see iOS MVC

Source: Internet
Author: User

In fact, these days have been trying to find time to put this sentiment sorted out, but also this section has been thinking about the problem, because this section to participate in a PHP background project development, the framework uses CI, with the progress of the project, the more CI contact, but because the understanding may not be profound, I just saw what I saw, So if there is something wrong, please give your opinion and correct me.

These days contact the CI framework, found that its MVC pattern use so clear and concise, completely according to the MVC of the separate organizational module, and model, view and controller interaction as long as the call method can, if there is a lot of interaction, the controller in the number of methods may increase, However, the module can be stripped to simplify the controller, however, the increase in the number of this method does not cause controller bloated, because the user and interface-related interactions are in the view with JS dynamic, and model modification, Controller is called the Model parameter, the view in the active interaction with the controller does not seem to be limited, and I now know that model can return data to the controller, but do not know how to actively invoke the controller. But the simplicity of this single process was a surprise to me at first. Although the meaning of the MVC pattern is the same everywhere, the difference in use and the language architecture can lead to different results and effects, such as the interaction of MVC in iOS that restricts the interaction of the view and model active to the controller, not just a layer of limitations, Controller is free to call the view and model, the simplest way to pass the parameter is the value of the property, and if a view has a user action to call the controller will not be so easy, but the agent can remove the problem, but the proxy delegate mode is clear, The final interaction of the main operation is in the controller, and model if the change and want to Congtroller to respond, it is not easy, KVO mode and the use of notifications can also be resolved, but this layer of limitations is to avoid.

From CI view, the view layer is not just the display, user interaction in the view may be able to make the controller is not so bloated, and MVC under the controller's bloated is the iOS architecture model has been discussed in the issue, But if you put a part of the user's response directly on the view layer will also have problems, many times the view layer can receive user action, but if not model communication is not able to respond, or to avoid the controller, then exactly where should start, my final idea is, Should be model, perhaps model is not only as a display of data content, if it is given the necessary method, may help controller to share part of the work, but this is limited.

In fact, I have always thought that iOS if the controller's Content module division, can reduce the controller redundancy, if now to share part of the model, redundancy will be lower, but after all, can not achieve the simplicity of CI, And since the discussion of controller redundancy has also spawned MVVM, it's just that I'm not very skilled at using this model, just know how it is, and the current MVVM pattern is not as mature as MVC, Streamlining the controller estimate will be a discussion that is going on all the time.

PHP Project sentiment--from the CI framework to see iOS MVC

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.