Coupling

What is tight and loose coupling in software architecture all about and why is it important?

As seen in the diagram below the tightly coupled side testifies of a convoluted structure, with multiple parts of the system being dependant on other parts. This relates to a ripple effect going through the system when changes are made.

 

coupling-sketches-cropped-1.png

source

The loosely coupled side on the other hand is written in such a way that these co- dependencies are preferably removed or minimized. The use of software interfaces is key in achieving a loosely coupled system. To achieve a higher level of “decoupledness”, dependency injection (DI) should be implemented. By doing so inversion of control (IoC) will be achieved, leaving the responsibility with a dependency injection container to supply the application with the required interfaces to complete its task.

The following two articles explore what it relates to in a practical form:

Tight Coupling. – Here we will look at the “wrong way” of doing it.

Loose coupling with dependency injection(DI). – Here we will rectify the same program used in the “wrong way” by using Interfaces and the Unity DI container from Microsoft.