I was studying few concepts of MVC on MSDN, and i reached on a point where they have written a word "loose coupling between the three main components of an MVC".
I searched a lot about the loose coupling on google. But i got different kind of answers every time.
Even i got a new word tight coupling and tight cohesion.
Can anyone define the word properly, and what it means exactly.
I'm looking forward for your replies.
Thanks.
Loose coupling is an approach to interconnecting the components in a system or network so that those components, also called elements, depend on each other to the least extent practicable. Coupling refers to the degree of direct knowledge that one element has of another.
Tight coupling means classes and objects are dependent on one another. In general, tight coupling is usually not good because it reduces the flexibility and re-usability of the code while Loose coupling means reducing the dependencies of a class that uses the different class directly.
Loose coupling refers to the connection between components of a system or network, such as software applications or hardware. It's an approach in which components (or elements), although connected, aren't dependent on one another.
Loose coupling enables isolation. Components to be deployed independently of one another, giving you much more freedom over when and what you deploy. Cross-functional delivery teams are able get their work done without having to manage any dependencies on other teams.
Loose coupling is simply writing software in such a way that all your classes can work independently without relying on each other. Since you're studying MVC I'll use it as an example to demonstrate the concept of loose coupling:
1) Tight coupling
ASP.NET Web forms are tightly coupled. Each .aspx page is dependent on it's code behind page which makes automated testing a nightmare
2) Loose coupling
ASP.NET MVC is loosely coupled.The logic is separated into 3 parts:
The three parts can be changed independently without affecting one another and thanks to the principle of separation of concern we can easily write automated tests to test our Models without having to rely on Views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With