在客户端MVC,谁应该处理客户端服务器通信? [英] In client side MVC, who should handle client-server communication?

查看:131
本文介绍了在客户端MVC,谁应该处理客户端服务器通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个客户机/服务器产品。基本上,服务器将文件传输到客户端做编辑。该客户端具有完全的MVC架构。该文件是模型。

I'm working on a client/server product. Basically, server will transfer a document to client side to do editing. The client side has full MVC architecture. The document is the model.

现在的问题是:


  1. 有在需要一些资源在服务器模型的一些计算。

  2. 出于性能的原因,模型的某些部分应该是懒加载。

一个实例是文件中的图像。打开文档时它没有加载,但有是加载图像的东西,一旦加载它可以让文档知道文件将重新计算布局。

One example is the image in a document. It didn't load when opening the document, but there is something that load the image, once it loaded it will let the document know and document will recalculate the layout.

我的问题是,如果通信code是模型或控制器的一部分?或者,它属于一些背景,既不型号也不控制器?或上下文所属的模式?

My question is if the communication code is part of Model or Controller? Or it belongs to some Context that is neither Model nor Controller? Or the Context belongs to Model?

推荐答案

模型层应与数据源进行交互。在客户端 - 服务器设置,你有两个单独的和独立的黑社会情况下,客户的模型层中的数据源是服务器的presentation层。

The model layer should be interacting with data source. In case of client-server setup where you have two separate and independent triads, the data source for client's model layer would be server's presentation layer.

基本上,您的客户端模型层变为<一个href=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/MVC-Process.png/200px-MVC-Process.png\"相对=nofollow>服务器端的用户。

Basically, your client-side's model layer becomes the user of server-side.

这篇关于在客户端MVC,谁应该处理客户端服务器通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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