问题描述
我想知道MVC(这是一种架构模式)与应用程序的n层架构之间到底有什么区别?我进行了搜索,但找不到简单的解释.也许我对MVC概念有些天真,所以如果有人可以解释其中的区别,那就太好了.
欢呼
N层体系结构通常具有由网络分隔的每一层. IE.表示层位于某些Web服务器上,然后通过网络与后端应用程序服务器进行业务逻辑对话,然后又通过网络与数据库服务器进行对话,也许该应用程序服务器还调出了一些远程服务(例如Authorize.net进行付款处理.
MVC是一种编程设计模式,其中代码的不同部分负责表示某些应用程序中的模型,视图和控制器.这两件事是相关的,因为例如模型层可能具有内部实现,该实现调用数据库以存储和检索数据.控制器可以驻留在Web服务器上,并远程调用应用服务器以检索数据. MVC提取了如何实现应用程序体系结构的详细信息.N层仅指实现的物理结构.由于通常使用N层体系结构来实现MVC设计,因此有时会混淆这两者.
I was wondering what exactly is the difference between MVC(which is an architectural pattern) and an n-tier architecture for an application. I searched for it but couldn't find a simple explanation. May be I am a bit naive on MVC concepts, so if anyone can explain the difference then it would be great.
cheers
N-tier architecture usually has each layer separated by the network. I.E. the presentation layer is on some web servers, then that talks to backend app servers over the network for business logic, then that talks to a database server, again over the network, and maybe the app server also calls out to some remote services (say Authorize.net for payment processing).
MVC is a programming design pattern where different portions of code are responsible for representing the Model, View, and controller in some application. These two things are related because, for instance the Model layer may have an internal implementation that calls a database for storing and retrieving data. The controller may reside on the webserver, and remotely call appservers to retrieve data. MVC abstracts away the details of how the architecture of an app is implemented.
N-tier just refers to the physical structure of an implementation. These two are sometimes confused because an MVC design is often implemented using an N-tier architecture.
这篇关于MVC与n层架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!