什么是MVC框架,为什么它是必要/有用的? [英] What is an MVC framework and why is it necessary/useful?

查看:70
本文介绍了什么是MVC框架,为什么它是必要/有用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道MVC框架允许您分离业务逻辑,数据库访问和表示,但是为什么我们需要一个框架来做到这一点.

I know that an MVC framework allows you to separate business logic, data base access and presentation, but why do we need a framework to do this.

我们不能只是将类分开,也许对模型,视图和控制器类使用不同的包/文件夹吗?

Can't we just keep our classes separated, perhaps using different packages/folders for the model, view and controller classes?

推荐答案

在我看来,您所谈论的是MVC模式,而不是特定的框架.当然,您可以将所有类保留在一个项目中,并且仍然使用MVC模式,因为视图中具有所有UI代码,控制器中具有逻辑,...

In my opinion the thing you are talking about is the MVC pattern and not a specific framework. Of course you can go and keep all your classes within one project and still use the MVC pattern, as you have all your UI code in the views, the logic in the controllers, ...

另一方面,MVC框架使您更容易使用此模式.它可能为控制器提供一些基本类,并为视图和控制器之间的通信提供一种机制.

A MVC framework on the other hand makes it easier for you to use this pattern. It may provide some base classes for controllers and a mechanism for the communication between view and controller.

我不知道您是否熟悉ASP.NET MVC.该框架本身很小,但是它可以帮助您使用MVC模式开发应用程序,因为您无需考虑先前描述的区域...

I don't know if you are familiar with ASP.NET MVC. The framework itself is very small, but it helps you developing an application with the MVC pattern, as you don't have do think about the previously decribed areas...

希望这会有所帮助

这篇关于什么是MVC框架,为什么它是必要/有用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆