[英]How do we “partition” our web project using the MVC pattern?
I have to develop a webapp for my teacher that he'll use to manage his students.It has to do the following: 我必须为我的老师开发一个Web应用程序,他将使用该应用程序来管理他的学生,它必须执行以下操作:
The difficulty I am facing is how to "partition" this project using the MVC pattern? 我面临的困难是如何使用MVC模式对项目进行“划分”? Should I do one model and one controller for every component of the app?
我应该为应用程序的每个组件做一个模型还是一个控制器?
Or should I just use one controller and put all methods in it? 还是应该只使用一个控制器并将所有方法放入其中?
Does every controller I add to the app must have it's model? 我添加到应用程序的每个控制器都必须具有其模型吗?
I have fully understood what are the responsibilities of the model and the view and the controller, but I can't wrap my head around how to use this pattern to "model" the application. 我已经完全理解了模型,视图和控制器的职责,但是我无法确定如何使用这种模式对应用程序进行“建模”。 Can you give me tips or clarifications about this?
您能给我提示或澄清吗? Maybe books I should read?
也许我应该读书? etc ...
等...
Thank you. 谢谢。
Each component in the app should have its MVC equivalent. 应用程序中的每个组件都应具有与其等效的MVC。 For instance you could have a StudentManagement Controller, Student Model and a folder that has all the views pertaining to the student.
例如,您可能有一个StudentManagement Controller,Student Model和一个包含所有与该学生有关的视图的文件夹。 This encourages modular programming.
这鼓励了模块化编程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.