-
MVC Components
(1)View——处理UI
Displays data to user in easy-to-understand format that is suitable for the device (HTML, CSS and templates模板).
以适合设备的易于理解的格式(HTML、CSS和模板)向用户显示数据。
Communicates with the Controller: user actions create requests to the application.
与控制器通信:用户操作创建对应用程序的请求。
(2)Controller——处理请求
Processes the requests, updates the model, gets data from the model, passes data back to the view.
处理请求、更新模型、从模型获取数据、将数据传递回视图。
(3)Model——处理数据模型
Maintains the data model of the application and the application logic
but communicates with the controller.
The model doesn't communicate directly with the view.
维护应用程序的数据模型和应用程序逻辑
但与控制器通信。
模型不直接与视图通信。
模型中的类表示系统操作的实体。每个类都有,通过分组与实体相关的数据和操作来表示某种实体。视图的实现允许用户与系统的各个方面进行交互,并执行不同的任务。更改视图对其他组件几乎没有影响。控制器中的类表示系统执行的各种任务(用例)。控制器封装了执行任务所需的逻辑。