stackjlei stackjlei - 2 years ago 124
Javascript Question

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:

Decoupled client: MVC frameworks like backbone.js incentivise you to
use REST API's though their urlRoot attribute in their Models;

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?

Answer Source

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.

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. 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download