简体   繁体   English

与客户脱钩是什么意思?

[英]what does decouple client mean?

I'm preparing for front end dev interview and was reading this blog and the author mentions that MVC provides you: 我正在准备进行前端开发人员采访,并且正在阅读此博客 ,并且作者提到MVC为您提供:

Decoupled client: MVC frameworks like backbone.js incentivise you to use REST API's though their urlRoot attribute in their Models; 分离的客户端:MVC框架(例如骨干.js)通过其模型中的urlRoot属性激励您使用REST API。

What does this mean? 这是什么意思? I thought decoupling means that parts of code are unaware of each other - how does using REST API's of backbone make the models unaware of other parts? 我认为解耦意味着代码的各个部分之间彼此不知道-使用REST API主干如何使模型不知道其他部分?

Decoupling is just an English word that means: 去耦只是一个英文单词,表示:

separate, disengage, or dissociate (something) from something else. 与某物分离,脱离或分离(某物)。

It has no specific technical relationship, but is often used in code speak to imply independence. 它没有特定的技术关系,但是经常在代码中使用以暗示独立性。 In your REST example above, it means that the client and server are independent from each other, so that they can literally be completely swapped out, so long as they communicate along some agreed interface. 在上面的REST示例中,这意味着客户端和服务器是彼此独立的,因此,只要它们沿着某个约定的接口进行通信,它们就可以被完全替换掉。

You are also correct, that it is commonly used to describe independent code. 您也是正确的,它通常用于描述独立代码。


As per your comment about coupled client/server. 根据您对耦合的客户端/服务器的评论。 A coupled client/server setup simply implies that either the client and server cannot be swapped out. 客户端/服务器的耦合设置仅意味着客户端和服务器都不能换出。 I think the keyword in that blog point is REST . 我认为该博客中的关键字是REST As this is an agreed upon protocol, a third party is able to work on your project without any assumptions about the underlying interface. 由于这是一个约定的协议,因此第三方可以在您的项目上工作,而无需任何有关基础接口的假设。 If you created your own communication protocol, you would consider this more coupled due to the extra information required. 如果您创建了自己的通信协议,则由于需要额外的信息,您会认为这种耦合更加紧密 In other words, you would need to know more about the client in order to build a server and vice versa. 换句话说,您需要了解有关客户端的更多信息才能构建服务器,反之亦然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM